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/07/11 19:30:04 UTC

[jira] Commented: (HARMONY-4411) [classlib][luni][ibmvm][jedit] URL.getHost() returns null

    [ https://issues.apache.org/jira/browse/HARMONY-4411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511804 ] 

Vasily Zakharov commented on HARMONY-4411:
------------------------------------------

Further investigation shows, that URL class is not guilty, and the problem resides in ClassLoader.getSystemResource() method. Moreover, the problem doesn't occur if the resource being requested resides in a directory, or in a jar file in classpath, but the problem does occur if the resource being requested resides in a jar file in bootclasspath.

Here's the simple test demonstrating that. Please put the attached test.jar file to the same directory as the test.

public class Test {
    public static void main(String[] args) {
         java.net.URL url = ClassLoader.getSystemResource("a");
         System.out.println("URL: " + url);
         String host = url.getHost();
         System.out.println("Host: " + host);
         System.out.println("".equals(host) ? "SUCCESS" : "FAIL");
    }
}

Output on RI and Harmony/DRLVM:

C:\> java -cp .;test.jar Test
URL: jar:file:/C:/test.jar!/a
Host:
SUCCESS

C:\>java -Xbootclasspath/p:test.jar Test
URL: jar:file:/C:/test.jar!/a
Host:
SUCCESS

Output Harmony/IBMVM:

C:\> java -cp .;test.jar Test
URL: jar:file:/C:/test.jar!/a
Host:
SUCCESS

C:\> java -Xbootclasspath/p:test.jar Test
URL: jar:file:/C:/test.jar!/a
Host: null
FAIL


> [classlib][luni][ibmvm][jedit] URL.getHost() returns null
> ---------------------------------------------------------
>
>                 Key: HARMONY-4411
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4411
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Vasily Zakharov
>
> Consider the following simple test:
> public class Test {
>     public static void main(String[] args) {
>          Class cls = javax.swing.plaf.metal.MetalLookAndFeel.class;
>          java.net.URL url = cls.getResource("icons/Error.gif");
>          System.out.println("URL: " + url);
>          String host = url.getHost();
>          System.out.println("Host: " + host);
>          System.out.println("".equals(host) ? "SUCCESS" : "FAIL");
>     }
> }
> Output on RI:
> URL: jar:file:/C:/Program%20Files/Java/jre1.5.0_11/lib/rt.jar!/javax/swing/plaf/metal/icons/Error.gif
> Host:
> SUCCESS
> Harmony/DRLVM:
> URL: jar:file:/C:/HarmonyTrunk/working_vm/build/deploy/jdk/jre/lib/boot/swing.jar!/javax/swing/plaf/metal/icons/Error.gif
> Host:
> SUCCESS
> Harmony/IBMVM:
> URL: jar:file:/C:/HarmonyTrunk/working_classlib/deploy/jdk/jre/lib/boot/swing.jar!/javax/swing/plaf/metal/icons/Error.gif
> Host: null
> FAIL
> Though the test passes on DRLVM, I suspect a problem in java.net.URL implementation in classlib.
> The problem was discovered while running jEdit on Harmony.

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