2007/1/22, Stepan Mishura <[EMAIL PROTECTED]>:
On 1/19/07, Ruth Cao wrote: > > 2007/1/19, Stepan Mishura: > > > > On 1/19/07, Stepan Mishura wrote: > > > > > > On 1/19/07, Ruth Cao wrote: > > > > > > > > Hi all, > > > > > > > > When working on HARMONY-2910, we've found that current Harmony code > > does > > > > not > > > > support relative pathname symbols (such as '.', '..', etc.) in > policy > > > > file. > > > > > > > > Details can be found at > > > > http://issues.apache.org/jira/browse/HARMONY-2910 > > > > > > > > I think it may be feasible to add a method to convert the URL > location > > > > of > > > > CodeSource into 'standard' forms (which has no '.', '..' but has the > > > > same > > > > meaning). > > > > > > > > > Hi Ruth, > > > > > > I assume that relative path name symbols may be used in other modules. > > So > > > why we have to add a method for URL converting to 'security' module > not > > to > > > 'luni'? > > > IOW, is this issue specific for security code only? > > > > > > > > > > I reread my post and I want to clarify what I meant: I think that we > > should > > add this method to 'luni' util class because I assume that this > > functionality may be used not only by 'security' module. > > > I'm afraid it is... Both RI and Harmony does not parse these symbols in > the > URL class. Both of them passed the following test case: > > public class URLTest extends{ > public void test_pathname() throws Exception { > URL url1 = new URL("file:/home/../home/1.txt"); > assertEquals("/home/../home/1.txt", url1.getFile()); > URL url2 = new URL("file:/home/1.txt"); > assertEquals("/home/1.txt", url2.getFile()); > assertFalse(url1.equals(url2)); > } > } > > Thus, perhaps it is a good choice to add a method such as > PolicyUtils.normalizeURL(String url). Any comments? Can URI <file:///C:/Doc/java/1.5/docs/api/java/net/URI.html >.*normalize*() functionality be used for this case?
Thank you very much for your advice, Stepan. I've tried this method successfully. Besides, it seems that Harmony does not support these symbols in Policy.getPermission(CodeSource) when the param contains them. I'll upload a new patch and include the fix mentioned above. Thanks,
Stepan Mishura Intel Enterprise Solutions Software Division
-- Best regards, Ruth Cao China Software Development Lab, IBM
