Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import net.sourceforge.jnlp.util.RestrictedFileUtils;
import net.sourceforge.jnlp.util.logging.LogConfig;
import net.sourceforge.jnlp.util.logging.OutputController;
import sun.net.www.protocol.jar.URLJarFile;

import javax.jnlp.ServiceManager;
import javax.naming.ConfigurationException;
Expand Down Expand Up @@ -300,8 +299,6 @@ public static void initialize() throws IllegalStateException {
Security.setProperty("package.access",
Security.getProperty("package.access")+",net.sourceforge.jnlp");

URLJarFile.setCallBack(CachedJarFileCallback.getInstance());

initialized = true;
LOG.debug("End JNLPRuntime.initialize()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import net.sourceforge.jnlp.cache.NativeLibraryStorage;
import net.sourceforge.jnlp.config.ConfigurationConstants;
import net.sourceforge.jnlp.runtime.ApplicationInstance;
import net.sourceforge.jnlp.runtime.CachedJarFileCallback;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.security.AppVerifier;
import net.sourceforge.jnlp.security.JNLPAppVerifier;
Expand Down Expand Up @@ -1253,7 +1252,7 @@ private Void doActivateJars(List<JARDesc> jars) {
URL fileURL = new URL("file://" + extractedJarLocation);
// there is no remote URL for this, so lets fake one
URL fakeRemote = new URL(jar.getLocation().toString() + "!" + je.getName());
CachedJarFileCallback.getInstance().addMapping(fakeRemote, fileURL);
//CachedJarFileCallback.getInstance().addMapping(fakeRemote, fileURL);
addURL(fakeRemote);

jarLocationSecurityMap.put(new UrlKey(fakeRemote), jarSecurity);
Expand All @@ -1268,12 +1267,16 @@ private Void doActivateJars(List<JARDesc> jars) {
}
}

addURL(jar.getLocation());
if (localFile != null) {
addURL(localFile.toURI().toURL());
} else {
addURL(jar.getLocation());
}

// there is currently no mechanism to cache files per
// instance.. so only index cached files
if (localFile != null) {
CachedJarFileCallback.getInstance().addMapping(jar.getLocation(), localFile.toURI().toURL());
//CachedJarFileCallback.getInstance().addMapping(jar.getLocation(), localFile.toURI().toURL());

try (JarFile jarFile = new JarFile(localFile.getAbsolutePath())) {
JarIndexAccess index = JarIndexAccess.getJarIndex(jarFile.getNative());
Expand All @@ -1282,7 +1285,7 @@ private Void doActivateJars(List<JARDesc> jars) {
}
}
} else {
CachedJarFileCallback.getInstance().addMapping(jar.getLocation(), jar.getLocation());
//CachedJarFileCallback.getInstance().addMapping(jar.getLocation(), jar.getLocation());
}

LOG.debug("Activate jar: {}", location);
Expand Down Expand Up @@ -1573,9 +1576,12 @@ private void addNewJar(final JARDesc desc, UpdatePolicy updatePolicy) {
return null;
});

addURL(remoteURL);
CachedJarFileCallback.getInstance().addMapping(remoteURL, cachedUrl);

File localFile = tracker.getCacheFile(remoteURL);
if (localFile != null) {
addURL(remoteURL.toURI().toURL());
} else {
addURL(remoteURL);
}
} catch (Exception e) {
// Do nothing. This code is called by loadClass which cannot
// throw additional exceptions. So instead, just ignore it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@NotThreadSafe
@Ignore
Expand Down Expand Up @@ -555,7 +554,6 @@ public void testLoadClass() throws Exception {
JNLPRuntime.setSecurityEnabled(false);
JNLPRuntime.setDebug(true);
getConfiguration().setProperty(ConfigurationConstants.KEY_ENABLE_MANIFEST_ATTRIBUTES_CHECK, "NONE");
URLJarFile.setCallBack(CachedJarFileCallback.getInstance());

final ServerLauncher as = ServerAccess.getIndependentInstance(jnlp.getParent(), port);
try {
Expand All @@ -569,7 +567,6 @@ public void testLoadClass() throws Exception {
JNLPRuntime.setSecurityEnabled(securityBackup);
JNLPRuntime.setDebug(verbose);
getConfiguration().setProperty(ConfigurationConstants.KEY_ENABLE_MANIFEST_ATTRIBUTES_CHECK, manifestAttsBackup);
URLJarFile.setCallBack(null);
as.stop();

clearCache();
Expand Down