Skip to content

Commit fc63218

Browse files
authored
Merge pull request #902 from AdoptOpenJDK/ows-hangs-on-filenotfound
Ows hangs on filenotfound
2 parents 73571a8 + 7edc652 commit fc63218

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

core/src/main/java/net/adoptopenjdk/icedteaweb/client/GuiLaunchHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
import net.adoptopenjdk.icedteaweb.client.parts.splashscreen.JNLPSplashScreen;
3737
import net.adoptopenjdk.icedteaweb.jnlp.element.information.IconKind;
38+
import net.adoptopenjdk.icedteaweb.logging.Logger;
39+
import net.adoptopenjdk.icedteaweb.logging.LoggerFactory;
3840
import net.adoptopenjdk.icedteaweb.resources.ResourceTracker;
3941
import net.adoptopenjdk.icedteaweb.ui.swing.SwingUtils;
4042
import net.sourceforge.jnlp.AbstractLaunchHandler;
@@ -53,6 +55,7 @@
5355
*/
5456
public class GuiLaunchHandler extends AbstractLaunchHandler {
5557

58+
private static final Logger LOG = LoggerFactory.getLogger(GuiLaunchHandler.class);
5659
private volatile JNLPSplashScreen splashScreen = null;
5760
private final Object mutex = new Object();
5861

@@ -67,6 +70,7 @@ public void launchCompleted(ApplicationInstance application) {
6770

6871
@Override
6972
public void handleLaunchError(final LaunchException exception) {
73+
LOG.debug("HandleLaunchError Sbow BasicExceptionDialog {}", exception.getMessage());
7074
BasicExceptionDialog.willBeShown();
7175
SwingUtils.invokeLater(() -> {
7276
closeSplashScreen();

core/src/main/java/net/adoptopenjdk/icedteaweb/resources/ResourceHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ private static void validateWithWhitelist(URL url) {
9393
if (isUrlInWhitelist(url, getApplicationUrlWhiteList())) {
9494
return;
9595
}
96-
BasicExceptionDialog.show(new SecurityException(Translator.R("SWPInvalidURL") + ": " + url));
9796
LOG.error("Resource URL not In Whitelist: {}", url);
97+
BasicExceptionDialog.show(new SecurityException(Translator.R("SWPInvalidURL") + ": " + url));
9898
JNLPRuntime.exit(-1);
9999
}
100100
}

core/src/main/java/net/adoptopenjdk/icedteaweb/resources/downloader/BaseResourceDownloader.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
import net.adoptopenjdk.icedteaweb.resources.Resource;
1313
import net.adoptopenjdk.icedteaweb.resources.cache.Cache;
1414
import net.adoptopenjdk.icedteaweb.resources.cache.DownloadInfo;
15+
import net.adoptopenjdk.icedteaweb.ui.swing.SwingUtils;
1516
import net.sourceforge.jnlp.config.ConfigurationConstants;
1617
import net.sourceforge.jnlp.runtime.JNLPRuntime;
1718
import net.sourceforge.jnlp.util.UrlUtils;
1819

1920
import java.io.ByteArrayInputStream;
2021
import java.io.File;
22+
import java.io.FileNotFoundException;
2123
import java.io.IOException;
2224
import java.io.InputStream;
2325
import java.net.Socket;
@@ -73,7 +75,7 @@ public Resource download() {
7375
.map(Optional::get)
7476
.findFirst()
7577
.orElseGet(() -> {
76-
LOG.error("could not download resource {} from any of theses urls {} {}", resource, downloadUrls, exceptionMessage());
78+
LOG.error("Could not download resource {} from any of theses urls {} {}", resource, downloadUrls, exceptionMessage());
7779
resource.setStatus(ERROR);
7880
checkForProxyError();
7981
return resource;
@@ -104,9 +106,13 @@ private String exceptionMessage(final Exception e) {
104106
private void checkForProxyError() {
105107
for (final Exception excp : downLoadExceptions) {
106108
final Throwable cause = excp.getCause();
107-
if (cause instanceof IOException && cause.getMessage().toLowerCase().contains("proxy")) {
108-
BasicExceptionDialog.show((IOException) cause);
109-
JNLPRuntime.exit(-1);
109+
if (cause instanceof IOException && !(cause instanceof FileNotFoundException) && cause.getMessage().toLowerCase().contains("proxy")) {
110+
LOG.debug("checkForProxyError : show Exception Dialog for exception : {} cause : {}", excp.getMessage(), cause.getMessage());
111+
BasicExceptionDialog.willBeShown();
112+
SwingUtils.invokeLater(() -> {
113+
BasicExceptionDialog.show((IOException) cause);
114+
JNLPRuntime.exit(-1, false);
115+
});
110116
}
111117
}
112118
}
@@ -118,6 +124,7 @@ private CompletableFuture<Resource> downloadFrom(final URL url) {
118124
try {
119125
result.complete(tryDownloading(url));
120126
} catch (Exception | Error e) {
127+
LOG.debug("downloadFrom exception: {}", e.getMessage());
121128
result.completeExceptionally(e);
122129
}
123130
});
@@ -131,6 +138,7 @@ private Resource tryDownloading(final URL downloadFrom) throws IOException {
131138

132139
if (downloadDetails.contentType != null && downloadDetails.contentType.startsWith(ERROR_MIME_TYPE)) {
133140
final String serverResponse = StreamUtils.readStreamAsString(downloadDetails.inputStream);
141+
LOG.debug("Server Error for {}", resource);
134142
throw new RuntimeException("Server error: " + serverResponse);
135143
}
136144

core/src/main/java/net/sourceforge/jnlp/runtime/JNLPRuntime.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,12 +894,19 @@ private static boolean isPluginDebug() {
894894
return pluginDebug;
895895
}
896896

897-
public static <T> T exit(int i) {
898-
waitForExceptionDialogsToBeClosed();
897+
public static <T> T exit(int i, boolean waitToCloseExceptionDialogs) {
898+
LOG.debug("JNLPRuntime,exit()");
899+
if (waitToCloseExceptionDialogs) {
900+
waitForExceptionDialogsToBeClosed();
901+
}
899902
System.exit(i);
900903
return null;
901904
}
902905

906+
public static <T> T exit(int i) {
907+
return exit(i, true);
908+
}
909+
903910
public static void waitForExceptionDialogsToBeClosed() {
904911
try {
905912
if (BasicExceptionDialog.areShown()) {

0 commit comments

Comments
 (0)