1212import net .adoptopenjdk .icedteaweb .resources .Resource ;
1313import net .adoptopenjdk .icedteaweb .resources .cache .Cache ;
1414import net .adoptopenjdk .icedteaweb .resources .cache .DownloadInfo ;
15+ import net .adoptopenjdk .icedteaweb .ui .swing .SwingUtils ;
1516import net .sourceforge .jnlp .config .ConfigurationConstants ;
1617import net .sourceforge .jnlp .runtime .JNLPRuntime ;
1718import net .sourceforge .jnlp .util .UrlUtils ;
1819
1920import java .io .ByteArrayInputStream ;
2021import java .io .File ;
22+ import java .io .FileNotFoundException ;
2123import java .io .IOException ;
2224import java .io .InputStream ;
2325import 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
0 commit comments