harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Deakin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2047) [classlib][luni]ClassLoader.getResourceAsStream() fails to get property file with special char in its name
Date Fri, 03 Nov 2006 14:51:17 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-2047?page=comments#action_12446975 ] 
Oliver Deakin commented on HARMONY-2047:

Walking through this in the debugger, I get the following stack trace:
	URL.<init>(String, String, int, String, URLStreamHandler) line: 418	
	URLAppClassLoader(URLClassLoader).targetURL(URL, String) line: 977	
	URLAppClassLoader(URLClassLoader).findResourceImpl(URL[], String) line: 767	
	URLClassLoader$5.run() line: 667	
	URLClassLoader$5.run() line: 1	
	AccessController.doPrivileged(PrivilegedAction, AccessControlContext) line: 201	
	URLAppClassLoader(URLClassLoader).findResource(String) line: 665	
	URLAppClassLoader(ClassLoader).getResource(String) line: 420	
	URLAppClassLoader(ClassLoader).getResourceAsStream(String) line: 480	
	JIRA2047.main(String[]) line: 6	

So the file location is being found using a URL. However, looking at line 418 of URL.java,
we can see that the file path is split when a # is encountered, as the part after the # is
expected to be a reference. The spec says:

A URL may have appended to it a "fragment", also known as a "ref" or a "reference". The fragment
is indicated by the sharp sign character "#" followed by more characters. For example, 

The question is, does the # still apply as a reference when the URL protocol is "file"? I
would think not, but cannot see in the spec anything to clarify.

> [classlib][luni]ClassLoader.getResourceAsStream() fails to get property file with special
char in its name
> ----------------------------------------------------------------------------------------------------------
>                 Key: HARMONY-2047
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2047
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Leo Li
> ClassLoader.getResourceAsStream() fails to get property file with special char in its
> Here is the testcase:
> (First pls put a property file called "AAA#.properties" in where can be searched by classpath.)
> public void testGetResourceAsStream() throws Exception
> {
>         InputStream in = TestClassLoader.class.getClassLoader().getResourceAsStream("AAA#.properties");
>         assertNotNull(in);
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message