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 @@ -1250,10 +1249,10 @@
final SecurityDesc jarSecurity = securityDelegate.getJarPermissions(codebase);

try {
URL fileURL = new URL("file://" + extractedJarLocation);

Check warning on line 1252 in core/src/main/java/net/sourceforge/jnlp/runtime/classloader/JNLPClassLoader.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "fileURL" local variable.

See more on https://sonarcloud.io/project/issues?id=AdoptOpenJDK_IcedTea-Web&issues=AZ4DNG5AzHBI8_4f5LYJ&open=AZ4DNG5AzHBI8_4f5LYJ&pullRequest=969
// 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);

Check warning on line 1255 in core/src/main/java/net/sourceforge/jnlp/runtime/classloader/JNLPClassLoader.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=AdoptOpenJDK_IcedTea-Web&issues=AZ4DNG5AzHBI8_4f5LYK&open=AZ4DNG5AzHBI8_4f5LYK&pullRequest=969
addURL(fakeRemote);

jarLocationSecurityMap.put(new UrlKey(fakeRemote), jarSecurity);
Expand All @@ -1268,12 +1267,16 @@
}
}

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());

Check warning on line 1279 in core/src/main/java/net/sourceforge/jnlp/runtime/classloader/JNLPClassLoader.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=AdoptOpenJDK_IcedTea-Web&issues=AZ4DNG5AzHBI8_4f5LYL&open=AZ4DNG5AzHBI8_4f5LYL&pullRequest=969

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

Check warning on line 1288 in core/src/main/java/net/sourceforge/jnlp/runtime/classloader/JNLPClassLoader.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=AdoptOpenJDK_IcedTea-Web&issues=AZ4DNG5AzHBI8_4f5LYM&open=AZ4DNG5AzHBI8_4f5LYM&pullRequest=969
}

LOG.debug("Activate jar: {}", location);
Expand Down Expand Up @@ -1551,7 +1554,7 @@
});

final URL remoteURL = desc.getLocation();
final URL cachedUrl = tracker.getCacheURL(remoteURL); // blocks till download

Check warning on line 1557 in core/src/main/java/net/sourceforge/jnlp/runtime/classloader/JNLPClassLoader.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "cachedUrl" local variable.

See more on https://sonarcloud.io/project/issues?id=AdoptOpenJDK_IcedTea-Web&issues=AZ4DNG5AzHBI8_4f5LYN&open=AZ4DNG5AzHBI8_4f5LYN&pullRequest=969

available.remove(desc); // Resource downloaded. Remove from available list.

Expand All @@ -1573,9 +1576,12 @@
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