harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2255) [classlib][luni]ClassLoader.getResourceAsStream fails to get file whose name with "%"
Date Fri, 18 May 2007 16:50:16 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496947

Mikhail Markov commented on HARMONY-2255:

I've found that the problem is in URLClassLoader. See the following piece of code from findResourceImpl

try {
    filename = URLDecoder.decode(filename, "UTF-8"); //$NON-NLS-1$
} catch (IllegalArgumentException e) {
    return null;
The documentation for URLDecoder states that '%' is treated as special character, so URLDecoder.decode()
method should not be used in findResourceImpl method. If I just commet this piece of code,
the test above starts working. The other tests also work without problems.
The variable filename is just used later in this expression "new File(filename).exists())"
and I do not see any reason of converting the filename to UTF8 as File should work with unicode
just fine.

So, I suggest to just remove the mentioned piece of code from URLClassLoader.findResourceImpl
Does anybody know what was the original purpose of having it there?

> [classlib][luni]ClassLoader.getResourceAsStream fails to get file whose name with "%"
> -------------------------------------------------------------------------------------
>                 Key: HARMONY-2255
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2255
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Leo Li
> Here is the testcase:
> public void testGetResourceAsStream() throws Exception 
>     { 
>             InputStream in = this.getClass().getClassLoader().getResourceAsStream("AAA%.properties");

>             assertNotNull(in); 
>     } 
> RI passes
> Harmony fails

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message