Harmony
  1. Harmony
  2. HARMONY-6573

[classlib][luni] Can't load classes with file://// and URL class

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0M14
    • Fix Version/s: 5.0M15
    • Component/s: Classlib
    • Labels:
      None

      Description

      Run below test case,

      import java.net.MalformedURLException;
      import java.net.URL;

      public class Test {

      public static void main(String args[]) throws MalformedURLException

      { URL url1 = new URL("file:////home/test.jar"); System.out.println("getAuthority:" + url1.getAuthority()); System.out.println("getFile:" + url1.getFile()); }

      }

      The output of harmony is:
      getAuthority:
      getFile://home/test.jar

      while the output of Sun RI is:
      getAuthority:null
      getFile:////home/test.jar

        Activity

        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #66 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/66/)
        Apply patch for HARMONY-6573: [classlib][luni] Can't load classes with file://// and URL class

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #66 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/66/ ) Apply patch for HARMONY-6573 : [classlib] [luni] Can't load classes with file://// and URL class
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #895 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/895/)
        Apply patch for HARMONY-6573: [classlib][luni] Can't load classes with file://// and URL class

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #895 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/895/ ) Apply patch for HARMONY-6573 : [classlib] [luni] Can't load classes with file://// and URL class
        Hide
        Regis Xu added a comment -

        Thanks Xiao Shu!!

        The patch was applied to trunk at r964691, please verify.

        Show
        Regis Xu added a comment - Thanks Xiao Shu!! The patch was applied to trunk at r964691, please verify.
        Hide
        Xiao Shu added a comment -

        The attached patch contains the fix and unit test case.

        Show
        Xiao Shu added a comment - The attached patch contains the fix and unit test case.
        Hide
        Xiao Shu added a comment -

        According to RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax,

        URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

        hier-part = "//" authority path-abempty
        / path-absolute
        / path-rootless
        / path-empty

        The scheme and path components are required, though the path may be
        empty (no characters). When authority is present, the path must
        either be empty or begin with a slash ("/") character. When
        authority is not present, the path cannot begin with two slash
        characters ("//").

        So if there are more than three slashes after ':', authority should be taken as null,

        Show
        Xiao Shu added a comment - According to RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax, URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty The scheme and path components are required, though the path may be empty (no characters). When authority is present, the path must either be empty or begin with a slash ("/") character. When authority is not present, the path cannot begin with two slash characters ("//"). So if there are more than three slashes after ':', authority should be taken as null,

          People

          • Assignee:
            Regis Xu
            Reporter:
            Xiao Shu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development