You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vasily Zakharov (JIRA)" <ji...@apache.org> on 2007/02/28 02:08:05 UTC

[jira] Created: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. propertly

[classlib][luni][netbeans] URL constructor doesn't handle .. propertly
----------------------------------------------------------------------

                 Key: HARMONY-3258
                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
             Project: Harmony
          Issue Type: Bug
          Components: App-Oriented Bug Reports, Classlib
            Reporter: Vasily Zakharov


This bug was discovered while trying to run Netbeans.

Consider this simple test:

import java.net.URL;

public class Test {
    public static void main(String args[]) throws Exception {
        String context = "jar:file:/a!/b";
        String spec = "../d";
        System.out.println(new URL(new URL(context), spec));

        context = "jar:file:/a!/b/c";
        spec = "../d";
        System.out.println(new URL(new URL(context), spec));
    }
}

Output on RI:

jar:file:/a!/d
jar:file:/a!/d

Output on Harmony:

jar:file:/a!/../d
jar:file:/a!/b/../d

In both cases Harmony output is incorrect, and also Harmony output in two cases is different, while it's identical on RI.


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


[jira] Updated: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-3258:
-------------------------------------

    Description: 
This bug was discovered while trying to run Netbeans.

Consider this simple test:

import java.net.URL;

public class Test {
    public static void main(String args[]) throws Exception {

        String context = "jar:file:/a!/b";
        String spec = "../d";
        System.out.println(new URL(new URL(context), spec));

        context = "jar:file:/a!/b/c";
        spec = "../d";
        System.out.println(new URL(new URL(context), spec));

        context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
        spec = "../pdf/PDF.settings";
        System.out.println(new URL(new URL(context), spec));
    }
}

Output on RI:

jar:file:/a!/d
jar:file:/a!/d
jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings

Output on Harmony:

jar:file:/a!/../d
jar:file:/a!/b/../d
jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings

In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.

I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.


  was:
This bug was discovered while trying to run Netbeans.

Consider this simple test:

import java.net.URL;

public class Test {
    public static void main(String args[]) throws Exception {
        String context = "jar:file:/a!/b";
        String spec = "../d";
        System.out.println(new URL(new URL(context), spec));

        context = "jar:file:/a!/b/c";
        spec = "../d";
        System.out.println(new URL(new URL(context), spec));
    }
}

Output on RI:

jar:file:/a!/d
jar:file:/a!/d

Output on Harmony:

jar:file:/a!/../d
jar:file:/a!/b/../d

In both cases Harmony output is incorrect, and also Harmony output in two cases is different, while it's identical on RI.



> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
>         spec = "../pdf/PDF.settings";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings
> In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.
> I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.

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


[jira] Assigned: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov reassigned HARMONY-3258:
----------------------------------------

    Assignee: Alexei Zakharov

> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>         Assigned To: Alexei Zakharov
>         Attachments: H-3258.patch
>
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
>         spec = "../pdf/PDF.settings";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings
> In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.
> I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.

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


[jira] Updated: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-3258:
-------------------------------------

    Patch Info: [Patch Available]

> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>         Attachments: H-3258.patch
>
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
>         spec = "../pdf/PDF.settings";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings
> In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.
> I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.

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


[jira] Updated: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Mikhail Markov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikhail Markov updated HARMONY-3258:
------------------------------------

    Attachment: H-3258.patch

Here is the patch and unit test.

Fix description: there was a bug in jar-protocol Handler as it did not try to canonicalize the path, so i've added this action there. It fully copies the same procedure from URLStreamHandler class, so i've moved this code to a new URLUtil class and call it from both classes.

> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>         Attachments: H-3258.patch
>
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
>         spec = "../pdf/PDF.settings";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings
> In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.
> I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.

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


[jira] Closed: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov closed HARMONY-3258.
------------------------------------


Thanks Alexei and Mikhail, the patch works fine.

Closing this issue.


> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>         Assigned To: Alexei Zakharov
>         Attachments: H-3258.patch
>
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
>         spec = "../pdf/PDF.settings";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings
> In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.
> I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.

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


[jira] Updated: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-3258:
-------------------------------------

    Summary: [classlib][luni][netbeans] URL constructor doesn't handle .. properly  (was: [classlib][luni][netbeans] URL constructor doesn't handle .. propertly)

> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> In both cases Harmony output is incorrect, and also Harmony output in two cases is different, while it's identical on RI.

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


[jira] Resolved: (HARMONY-3258) [classlib][luni][netbeans] URL constructor doesn't handle .. properly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-3258.
--------------------------------------

    Resolution: Fixed

Thanks Vasily, thanks Mikhail. I've committed the patch to class library code as well as slightly corrected version of the patch for test to the revision 513940. Please verify that everything was applied as expected.

> [classlib][luni][netbeans] URL constructor doesn't handle .. properly
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-3258
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3258
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>         Assigned To: Alexei Zakharov
>         Attachments: H-3258.patch
>
>
> This bug was discovered while trying to run Netbeans.
> Consider this simple test:
> import java.net.URL;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         String context = "jar:file:/a!/b";
>         String spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/a!/b/c";
>         spec = "../d";
>         System.out.println(new URL(new URL(context), spec));
>         context = "jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/Layer.xml";
>         spec = "../pdf/PDF.settings";
>         System.out.println(new URL(new URL(context), spec));
>     }
> }
> Output on RI:
> jar:file:/a!/d
> jar:file:/a!/d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/pdf/PDF.settings
> Output on Harmony:
> jar:file:/a!/../d
> jar:file:/a!/b/../d
> jar:file:/C:/Program%20Files/Netbeans-5.5/ide7/modules/org-netbeans-modules-utilities.jar!/org/netbeans/modules/utilities/../pdf/PDF.settings
> In all three cases Harmony output is incorrect, and also Harmony output in first two cases is different, while it's identical on RI.
> I'm not sure which class should have regression added to it (probably it's Jar URL handler), but please make sure to include all three test cases to the regression test.

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