harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Qiu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-6074) [classlib][luni] JAR referenced in a JAR's manifest 'Class-Path' that contains 'file' scheme URIs aren't loaded
Date Fri, 22 May 2009 08:26:45 GMT

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

Sean Qiu updated HARMONY-6074:
------------------------------

    Attachment: HARMONY-6074.diff

I've uploaed a workaround.
The isAbsolute(String) could be improved.
Commends is welcomed.


The reason Nathan's patch doesn't work is the URL is based on jar protocol.
Therefore the URL(URL context, String spec) couldn't work as expected in this case.

        // Relative path
        URL context = new URL("jar:file:/home/xiaoxia/temp.jar!/");
        String relative = "hello.jar";
        
        Expected result:  jar:file:/home/xiaoxia/hello.jar
        Actual result: jar:file:/home/xiaoxia/temp.jar!/hello.jar
        
        
        // Absolute path
        String absolute = "c://home/hello.jar";
        
        Expected result: jar:file:/home/hello.jar!/
        Actual result: file:/home/hello.jar
        

> [classlib][luni] JAR referenced in a JAR's manifest 'Class-Path' that contains 'file'
scheme URIs aren't loaded
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6074
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6074
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Nathan Beyer
>            Assignee: Nathan Beyer
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6074.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> I ran into this while running Abdera's Maven build with the Harmony trunk. Surefire,
the Maven plugin that invokes unit tests, when forked (default) creates an empty JAR file
with a manifest like this.
> Manifest-Version: 1.0
> Main-Class: org.apache.maven.surefire.booter.SurefireBooter
> Class-Path: file:/C:/Users/nathan/.m2/repository/org/apache/maven/surefi
>  re/surefire-booter/2.4.2/surefire-booter-2.4.2.jar file:/C:/Users/natha
>  n/.m2/repository/org/apache/maven/surefire/surefire-api/2.4.2/surefire-
>  api-2.4.2.jar file:/C:/dev/abdera/dependencies/i18n/target/test-classes
>  / file:/C:/dev/abdera/dependencies/i18n/target/classes/ file:/C:/Users/
>  nathan/.m2/repository/junit/junit/4.3/junit-4.3.jar file:/C:/Users/nath
>  an/.m2/repository/org/apache/geronimo/specs/geronimo-activation_1.0.2_s
>  pec/1.1/geronimo-activation_1.0.2_spec-1.1.jar
> When invoked, the Harmony JRE throws the following exception.
> Uncaught exception in main:
> java.lang.ClassNotFoundException: org.apache.maven.surefire.booter.SurefireBooter
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:892)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:489)
>         at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:871)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>         at org.apache.harmony.vm.JarRunner.main(JarRunner.java:72)
> I did some debugging it seems the source of the issue is in the java.net.URLClassLoader
in the method 'getInternalURLs(URL,String)'. While looping over the values in 'Class-Path',
new URLs are created, but they're always created relative to the base JAR, even though the
URI entry is absolute.
> I need to read over the manifest specification and make sure that absolute URIs should
be treated differently. Regardless, the Sun RI seems to support this capability.

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


Mime
View raw message