changeset 2351:328afd896e3e

PR794: javaws does not work if a Web Start app jar has a Class-Path element in the manifest.
author Deepak Bhole <dbhole@redhat.com>
date Thu, 29 Sep 2011 16:41:18 -0400
parents 0f6deb60d29b
children 941103576384
files ChangeLog NEWS netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java
diffstat 3 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jul 21 15:08:30 2011 +0100
+++ b/ChangeLog	Thu Sep 29 16:41:18 2011 -0400
@@ -1,3 +1,10 @@
+2011-09-29  Deepak Bhole <dbhole@redhat.com>
+
+	PR794: javaws does not work if a Web Start app jar has a Class-Path
+	element in the manifest.
+	* netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java
+	(retrieve): Blank out the Class-Path elements in manifest.
+
 2011-07-21  Andrew John Hughes  <ahughes@redhat.com>
 
 	* NEWS: Prepare for 1.9.10.
--- a/NEWS	Thu Jul 21 15:08:30 2011 +0100
+++ b/NEWS	Thu Sep 29 16:41:18 2011 -0400
@@ -10,6 +10,9 @@
 
 New in release 1.9.10 (2011-XX-XX):
 
+* NetX
+  - PR794: javaws does not work if a Web Start app jar has a Class-Path element in the manifest
+
 New in release 1.9.9 (2011-07-20):
 
 * Security fixes
--- a/netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java	Thu Jul 21 15:08:30 2011 +0100
+++ b/netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java	Thu Sep 29 16:41:18 2011 -0400
@@ -94,7 +94,24 @@
 
         if (UrlUtils.isLocalFile(localUrl)) {
             // if it is known to us, just return the cached file
-            return new JarFile(localUrl.getPath());
+            JarFile returnFile = new JarFile(localUrl.getPath());
+            
+            try {
+                
+                // Blank out the class-path because:
+                // 1) Web Start does not support it
+                // 2) For the plug-in, we want to cache files from class-path so we do it manually
+                returnFile.getManifest().getMainAttributes().putValue("Class-Path", "");
+
+                if (JNLPRuntime.isDebug()) {
+                    System.err.println("Class-Path attribute cleared for " + returnFile.getName());
+                }
+
+            } catch (NullPointerException npe) {
+                // Discard NPE here. Maybe there was no manifest, maybe there were no attributes, etc.
+            }
+
+            return returnFile;
         } else {
             // throw new IllegalStateException("a non-local file in cache");
             return null;