Skip to content

Commit

Permalink
OWS-606: FileNotFound treated as Proxy exception
Browse files Browse the repository at this point in the history
  • Loading branch information
janakmulani committed Apr 24, 2023
1 parent 73571a8 commit 8480571
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import net.adoptopenjdk.icedteaweb.resources.Resource;
import net.adoptopenjdk.icedteaweb.resources.cache.Cache;
import net.adoptopenjdk.icedteaweb.resources.cache.DownloadInfo;
import net.adoptopenjdk.icedteaweb.ui.swing.SwingUtils;
import net.sourceforge.jnlp.config.ConfigurationConstants;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.util.UrlUtils;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
Expand Down Expand Up @@ -104,9 +106,12 @@ private String exceptionMessage(final Exception e) {
private void checkForProxyError() {
for (final Exception excp : downLoadExceptions) {
final Throwable cause = excp.getCause();
if (cause instanceof IOException && cause.getMessage().toLowerCase().contains("proxy")) {
BasicExceptionDialog.show((IOException) cause);
JNLPRuntime.exit(-1);
if (cause instanceof IOException && !(cause instanceof FileNotFoundException) && cause.getMessage().toLowerCase().contains("proxy")) {
BasicExceptionDialog.willBeShown();
SwingUtils.invokeLater(() -> {
BasicExceptionDialog.show((IOException) cause);
JNLPRuntime.exit(-1, false);
});
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions core/src/main/java/net/sourceforge/jnlp/runtime/JNLPRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -894,12 +894,19 @@ private static boolean isPluginDebug() {
return pluginDebug;
}

public static <T> T exit(int i) {
waitForExceptionDialogsToBeClosed();
public static <T> T exit(int i, boolean waitToCloseExceptionDialogs) {
LOG.debug("JNLPRuntime,exit()");
if (waitToCloseExceptionDialogs) {
waitForExceptionDialogsToBeClosed();
}
System.exit(i);
return null;
}

public static <T> T exit(int i) {
return exit(i, true);
}

public static void waitForExceptionDialogsToBeClosed() {
try {
if (BasicExceptionDialog.areShown()) {
Expand Down

0 comments on commit 8480571

Please sign in to comment.