harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nina Rinskaya (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1858) [classlib][luni] NPE in JarURLConnection.findJarFile() breaks Eclipse help system
Date Tue, 17 Oct 2006 08:43:42 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1858?page=all ]

Nina Rinskaya updated HARMONY-1858:
-----------------------------------

    Attachment: harmony-1858-fix.patch.txt

It looks that the problem is in org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnection.java:


Private method findJarFile() (invoked by public method java.net.JarURLConnection.getJarFile())
calls private method openJarFile(String fileString, String key, boolean temp) with 'null'
as first argument, and in some cases (when jar file to be opened is not in local file system
and if we explicitly indicate to ignore caches) it throws NPE. If we set 'fileString' argument
to full jar file URL (see the patch attached), everything looks to work ok. 

With the patch attached the simple test reproducing the problem (see below) passes OK and
Eclipse Help also looks to work OK with no errors in log files. But please double-check suggested
fix because the methods mentioned above are not so obvious, and it could produce new failures.


I don't provide JUnit test, since it will require launching web (or ftp) server and will make
the whole test over-complicated and less obvious. Please let me know if I should provide such
code nevertheless.

To reproduce:

1. Run web server (tomcat, for example), and put some jar file somewhere to its web directory.
For example, I ran Tomcat on port 8080 and put file.jar to its root directory, so it was available
at http://localhost:8080/file.jar. 

2. Code for reproducing:

------Test.java--------

import java.net.URL;
import java.net.JarURLConnection;
import java.io.IOException;
import java.util.jar.JarFile;

public class Test{

    public void test() throws IOException {
        String s = "jar:http://localhost:8080/file.jar!/";
        URL url = new URL(s);
        JarURLConnection jarConn = (JarURLConnection) url.openConnection();
        jarConn.setUseCaches(false);
        JarFile jarFile = jarConn.getJarFile();
    }

    public static void main(String[] args) {
        try {
            new Test().test();
            System.out.println("OK");
        } catch (NullPointerException npe) {
            System.out.println("Failed: NPE was thrown when trying to open jar file: ");
            npe.printStackTrace();
        } catch (Throwable t) {
            System.out.println("Unexcpected failure: ");
            t.printStackTrace();
        }
    }
}

-----------------------


Output on RI:

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)

OK


------------------------

Output on Harmony:

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r463908, (Oct 16 2006), Linux/ia32/gcc 3.3.3, release build
http://incubator.apache.org/harmony
FAILED: NPE was thrown when trying to open jar file:
java.lang.NullPointerException
        at org.apache.harmony.luni.util.Util.decode(Util.java:239)
        at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.openJarFile(JarURLConnection.java:251)
        at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection$2.run(JarURLConnection.java:189)
        at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection$2.run(JarURLConnection.java:185)
        at java.security.AccessController.doPrivilegedImpl(Unknown Source)
        at java.security.AccessController.doPrivileged(Unknown Source)
        at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.findJarFile(JarURLConnection.java:184)
        at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:144)
        at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:160)
        at Test.test(Test.java:13)
        at Test.main(Test.java:25)



> [classlib][luni] NPE in JarURLConnection.findJarFile() breaks Eclipse help system
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-1858
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1858
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports
>         Environment: Eclipse 3.1.1/Eclipse 3.2 & Windows/Linux
>            Reporter: Yerlan A. Tokpanov
>         Attachments: harmony-1858-fix.patch.txt
>
>
> Start Eclipse, open menu Help->Help Contents. Help is opened with "HTTP 404 - File
not found" error.
> And, the logfile at %WORKSPACE%\.metadata\.plugins\org.eclipse.tomcat\catalina.2006-10-13.log
contains the following:
> WebappLoader[]: Deploying class repositories to work directory c:\users\lab_drlbuild\ccf\tests\win\3.1.1\EHLP\scenario_workspace\.metadata\.plugins\org.eclipse.tomcat\ROOT
> ContextConfig[]: Added certificates -> request attribute Valve
> StandardManager[]: Seeding random number generator class java.security.SecureRandom
> StandardManager[]: Seeding of random number generator has been completed
> StandardWrapper[:default]: Loading container servlet default
> StandardWrapper[:invoker]: Loading container servlet invoker
> CoyoteConnector Coyote can't register jmx for protocol
> WebappLoader[/help]: Deploying class repositories to work directory c:\users\lab_drlbuild\ccf\tests\win\3.1.1\EHLP\scenario_workspace\.metadata\.plugins\org.eclipse.tomcat\help
> WebappLoader[/help]: Deploy JAR /WEB-INF/lib/jsp.jar to C:\users\lab_drlbuild\ccf\3.1.1\eclipse\plugins\org.eclipse.help.webapp_3.1.0\WEB-INF\lib\jsp.jar
> WebappLoader[/help]: Deploy JAR /WEB-INF/lib/servlets.jar to C:\users\lab_drlbuild\ccf\3.1.1\eclipse\plugins\org.eclipse.help.webapp_3.1.0\WEB-INF\lib\servlets.jar
> ContextConfig[/help] Exception processing JAR at resource path /WEB-INF/lib/jsp.jar
> javax.servlet.ServletException: Exception processing JAR at resource path /WEB-INF/lib/jsp.jar
> 	at java.lang.Exception.<init>(Exception.java:49)
> 	at javax.servlet.ServletException.<init>(ServletException.java:134)
> 	at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:930)
> 	at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:867)
> 	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:645)
> 	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:242)
> 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3587)
> 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:805)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:593)
> 	at org.eclipse.tomcat.internal.TomcatAppServer.start(TomcatAppServer.java:487)
> 	at org.eclipse.help.internal.appserver.WebappManager.start(WebappManager.java:61)
> 	at org.eclipse.help.internal.base.BaseHelpSystem.ensureWebappRunning(BaseHelpSystem.java:245)
> 	at org.eclipse.help.internal.base.HelpDisplay.displayHelpURL(HelpDisplay.java:206)
> 	at org.eclipse.help.internal.base.HelpDisplay.displayHelpResource(HelpDisplay.java:87)
> 	at org.eclipse.help.ui.internal.DefaultHelpUI.displayHelpResource(DefaultHelpUI.java:233)
> 	at org.eclipse.ui.internal.help.WorkbenchHelpSystem.displayHelpResource(WorkbenchHelpSystem.java:899)
> 	at org.eclipse.ui.internal.ide.TipsAndTricksAction$1.run(TipsAndTricksAction.java:104)
> 	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:60)
> 	at org.eclipse.ui.internal.ide.TipsAndTricksAction.run(TipsAndTricksAction.java:102)
> 	at org.eclipse.jface.action.Action.runWithEvent(Action.java:997)
> 	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:536)
> 	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
> 	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3079)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2711)
> 	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1697)
> 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1660)
> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:365)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
> 	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:104)
> 	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:225)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:374)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
> 	at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
> 	at org.eclipse.core.launcher.Main.basicRun(Main.java:276)
> 	at org.eclipse.core.launcher.Main.run(Main.java:971)
> 	at org.eclipse.core.launcher.Main.main(Main.java:948)
> ----- Root Cause -----
> java.lang.NullPointerException
> 	at org.apache.harmony.luni.util.Util.decode(Util.java:239)
> 	at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.openJarFile(JarURLConnection.java:251)
> 	at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection$2.run(JarURLConnection.java:189)
> 	at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection$2.run(JarURLConnection.java:185)
> 	at java.security.AccessController.doPrivilegedImpl(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Unknown Source)
> 	at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.findJarFile(JarURLConnection.java:184)
> 	at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:144)
> 	at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:160)
> 	at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:905)
> 	at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:867)
> 	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:645)
> 	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:242)
> 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3587)
> 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:805)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:593)
> 	at org.eclipse.tomcat.internal.TomcatAppServer.start(TomcatAppServer.java:487)
> 	at org.eclipse.help.internal.appserver.WebappManager.start(WebappManager.java:61)
> 	at org.eclipse.help.internal.base.BaseHelpSystem.ensureWebappRunning(BaseHelpSystem.java:245)
> 	at org.eclipse.help.internal.base.HelpDisplay.displayHelpURL(HelpDisplay.java:206)
> 	at org.eclipse.help.internal.base.HelpDisplay.displayHelpResource(HelpDisplay.java:87)
> 	at org.eclipse.help.ui.internal.DefaultHelpUI.displayHelpResource(DefaultHelpUI.java:233)
> 	at org.eclipse.ui.internal.help.WorkbenchHelpSystem.displayHelpResource(WorkbenchHelpSystem.java:899)
> 	at org.eclipse.ui.internal.ide.TipsAndTricksAction$1.run(TipsAndTricksAction.java:104)
> 	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:60)
> 	at org.eclipse.ui.internal.ide.TipsAndTricksAction.run(TipsAndTricksAction.java:102)
> 	at org.eclipse.jface.action.Action.runWithEvent(Action.java:997)
> 	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:536)
> 	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
> 	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3079)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2711)
> 	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1697)
> 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1660)
> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:365)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
> 	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:104)
> 	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:225)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:374)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
> 	at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
> 	at org.eclipse.core.launcher.Main.basicRun(Main.java:276)
> 	at org.eclipse.core.launcher.Main.run(Main.java:971)
> 	at org.eclipse.core.launcher.Main.main(Main.java:948)
> ContextConfig[/help]: Marking this application unavailable due to previous error(s)
> StandardManager[/help]: Seeding random number generator class java.security.SecureRandom
> StandardManager[/help]: Seeding of random number generator has been completed
> StandardContext[/help]: Context startup failed due to previous errors

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message