IBM Support

PK64379; 6.1.0.15: ClassLoader.getResource Encodes Spaces in URLs

Download


Abstract

URLs returned from ClassLoader.getResource encode spaces as "%20". Not decoding can cause application failures.

Download Description

PK64379 resolves the following problem:

ERROR DESCRIPTION:
Change in behavior from IBM Websphere application Server V6.1.0.13 to V6.1.0.15. Applications that rely on unencoded spaces in URLs returned from ClassLoader.getResource will fail. Exceptions may show folder names with %20 java.io.FileNotFoundException:


C:\Program%20Files\IBM\WebSphere\AppServer\profiles\AppSrv01\...
(The system cannot find the path specified.)

LOCAL FIX:

PROBLEM SUMMARY

USERS AFFECTED:
WebSphere Application Server V6.1 users who install applications to a directory with a space in the name. In particular, Microsoft Windows users who install the product to C:\Program Files\.

PROBLEM DESCRIPTION:
URLs returned from ClassLoader.getResource encode spaces as "%20". Not decoding can cause application failures.

The fix for PK57900 modified class loader behavior so that the opaque URLs returned by application class loaders return spaces encoded as "%20". This behavior matches java.net.URLClassLoader, and it is required behavior for the URL.toURI() method, which was introduced in Java™ SE 5, to work properly.

PROBLEM CONCLUSION:
The class loader has been changed to behave as it did prior to V6.1.0.15 in order to maintain backwards compatibility with existing applications. To enable the behavior introduced in PK57900, you can set the system property:

com.ibm.ws.classloader.encodeResourceURLs


The valid values are false, which is default and causes behavior to match releases prior to V6.1.0.15 by preventing URLs from being encoded, which causes URLs to be encoded as intended by PK57900. Jave Virtual Machine (JVM) custom properties are described by this Information Center article:
Java Virtual Machine custom properties


Regardless of the setting, you are encouraged to use URL.openConnection() to avoid dependencies on the structure of the URLs returned by a class loader.

You are encouraged to set the system property to ensure portability between different environments; for example, URLClassLoader in a non-server test environment will return encoded URLs. If the system property is set and URL.openConnection() is insufficient, you are encouraged to construct java.io.File objects using the result of URL.toURI(), which can only be used reliably when the system property is set. If URL.getPath() or URL.getFile() must be used, then the result must be decoded before it is used.

The fix for this APAR is currently targeted for inclusion in Fix Pack 6.1.0.17. Please refer to the Recommended Updates page for delivery information:
http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980.

For WebSphere Application Server zOS customers, the fix for this APAR is currently targeted for inclusion in Fix Pack 6.1.0.16. Application Server for z/OS customers should follow their normal PTF ordering process. Please refer to the support page download section for additional PTF information:
http://www-306.ibm.com/software/webservers/appserv/zos_os390/support/

Prerequisites

Please download the UpdateInstaller below to install this fix.

[{"PRLabel":"UpdateInstaller","PRLang":"US English","PRSize":"7250000","PRPlat":{"label":"AIX","code":"PF002"},"PRURL":"http://www.ibm.com/support/docview.wss?rs=180&uid=swg21205991"}]

Installation Instructions

Please review the readme.txt for detailed installation instructions.

[{"INLabel":"Readme","INLang":"US English","INSize":"6802","INURL":"ftp://public.dhe.ibm.com/software/websphere/appserv/support/fixes/PK64379/readme.txt"}]

Download Package

Download package
What is Fix Central (FC)?
What is DD?
Download RELEASE DATE LANGUAGE SIZE(Bytes) Download Options
6.1.0.15-WS-WAS-IFPK643794/16/2008US English15402FCFTPDD

On
[{"DNLabel":"6.1.0.15-WS-WAS-IFPK64379","DNDate":"4/16/2008","DNLang":"US English","DNSize":"15402","DNPlat":{"label":"AIX","code":"PF002"},"DNURL":null,"DNURL_FTP":null,"DDURL":null}]

Technical Support

Contact IBM Support using SR (http://www-306.ibm.com/software/support/probsub.html), visit the WebSphere Application Server Support Web site (http://www.ibm.com/software/webservers/appserv/was/support/), or contact 1-800-IBM-SERV(U.S. only).

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Classloader","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.1.0.15","Edition":"Base;Express;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg24018970