You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Varlamov (JIRA)" <ji...@apache.org> on 2009/03/04 05:23:56 UTC

[jira] Resolved: (HARMONY-6106) [classlib][security] PolicyUtils.expandURL may return invalid URL on linux

     [ https://issues.apache.org/jira/browse/HARMONY-6106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov resolved HARMONY-6106.
--------------------------------------

       Resolution: Invalid
    Fix Version/s:     (was: 5.0M9)

Yes, PolicyUtils is (a part of) our default policy implementation, but I see no reason to deviate from RI in policy file syntax and other aspects of user interface (policy locations etc).
Looking at the RI policy documentation [1], I'd say you simply misused property expansion. Quoting:
1) "For example, the default system and user policy files are defined in the security properties file as 
policy.url.1=file:${java.home}/lib/security/java.policy
policy.url.2=file:${user.home}/.java.policy"
2) "Also, as a special case, if you expand a property in a codebase, such as 
    grant codeBase "file:${java.home}/lib/ext/"
then any file.separator characters will be automatically converted to /'s. Thus on a Win32 system, the above would get converted to 
    grant codeBase "file:C:/jdk1.4/jre/lib/ext/"
even if "java.home" is set to C:\jdk1.4\jre. Thus you don't need to use ${/} in codebase strings (and you shouldn't). "

Therefore, I resolve this issue as "Invalid".

[1] http://java.sun.com/j2se/1.5.0/docs/guide/security/PolicyFiles.html

> [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
>         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.