harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Regis Xu (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6106) [classlib][security] PolicyUtils.expandURL may return invalid URL on linux
Date Tue, 03 Mar 2009 16:00:56 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678354#action_12678354

Regis Xu commented on HARMONY-6106:

PolicyUtils is in o.a.h.security package, so it's depends on our implementation.

The key point is PolicyUtils.expandURL expected to return a string of URL, which could be
used to constructed
a URL, like above test, and reference that file use "file" protocol not "ftp".
"file:/home/bahamut/test " and "file://home/bahamut/test " are totally different, I believe
PolicyUtils.expandURL expected the former.

BTW, Harmony's behavior of processing URL "file://home/bahamut/test" is same with RI, so I
think URL do the right thing.
      URL url = new URL("file://c:/test/.java.policy");
      URLConnection conn = url.openConnection();

output of RI:
class sun.net.www.protocol.ftp.FtpURLConnection

output of Harmony:
class org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection

> [classlib][security] PolicyUtils.expandURL may return invalid URL on linux
> --------------------------------------------------------------------------
>                 Key: HARMONY-6106
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6106
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Regis Xu
>             Fix For: 5.0M9
>         Attachments: HARMONY-6106.diff
> the test:
>         Properties props = new Properties();
>         props.put("my.home", "/home/bahamut");
>         String location = PolicyUtils.expandURL("file:/${my.home}/test", props);
>         URL url = new URL(location);
>         System.out.println(url.getHost());
>         System.out.println(url.getPath());
>         System.out.println(url.toString());
> output is:
> home
> /bahamut/test
> file://home/bahamut/test
> the expanded URL is "file://home/bahamut/test", but what we want is "file:/home/bahamut/test",

> the one extra "/" make host of URL to be "home" which should be "", and then url.openConnection(),

> the wrong URL will use ftp protocol to open the file.

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

View raw message