? cvs.out ? patch48280.diff ? org/netbeans/core/jse141urlpatch Index: org/netbeans/core/NbURLStreamHandlerFactory.java =================================================================== RCS file: /cvs/core/src/org/netbeans/core/NbURLStreamHandlerFactory.java,v retrieving revision 1.8 diff -u -r1.8 NbURLStreamHandlerFactory.java --- org/netbeans/core/NbURLStreamHandlerFactory.java 16 Jul 2004 05:12:50 -0000 1.8 +++ org/netbeans/core/NbURLStreamHandlerFactory.java 5 Sep 2004 21:49:47 -0000 @@ -18,6 +18,8 @@ import java.util.*; import org.openide.ErrorManager; +import org.netbeans.core.jse141urlpatch.PatchedURLStreamHandlerFactory; + import org.openide.filesystems.FileUtil; import org.openide.util.*; @@ -29,6 +31,8 @@ */ final class NbURLStreamHandlerFactory implements URLStreamHandlerFactory, LookupListener { + private boolean j2se141 = System.getProperty("java.version").startsWith("1.4.1"); //NOI18N + private Lookup.Result r = null; private URLStreamHandlerFactory[] handlers = null; @@ -38,7 +42,16 @@ if (protocol.equals("jar") || protocol.equals("file") || // NOI18N protocol.equals("http") || protocol.equals("resource")) { // NOI18N // Well-known handlers in JRE. Do not try to initialize lookup, etc. - return null; + + URLStreamHandler handler = null; + if (j2se141) { + // In case we are running on J2SE 1.4.1 the jar and file protocol + // handling have to be patched. So we reroute the URL stream handler + // Craetion to the PatchedURLStreamHandlerFactory. + // Fixes: #44367 and #48280 + handler = PatchedURLStreamHandlerFactory.getInstance().createURLStreamHandler(protocol); + } + return handler; } URLStreamHandlerFactory[] _handlers; synchronized (this) { @@ -205,17 +218,7 @@ public String getHeaderField(String key) { tryToConnect(); if (connected) { - try { - return real.getHeaderField(key); - } catch (NullPointerException npe) { - // #44367: workaround for JRE 1.4.1 bug #5058092: - // getHeaderField on a jar resource causes spurious NPE - String realClass = real.getClass().getName(); - if (!(System.getProperty("java.version").startsWith("1.4.1") && // NOI18N - "sun.net.www.protocol.jar.JarURLConnection".equals(realClass))) { // NOI18N - throw npe; - } - } + return real.getHeaderField(key); } return null; }