@@ -185,7 +185,7 @@ private void downloadHttp(URI uri, boolean checkETag) throws DownloadException,
185185 }
186186 }
187187
188- ArrayList <IOException > exceptions = null ;
188+ ArrayList <Exception > exceptions = null ;
189189
190190 // If loading the cache fails, the cache should not be loaded again.
191191 boolean useCachedResult = true ;
@@ -284,10 +284,12 @@ private void downloadHttp(URI uri, boolean checkETag) throws DownloadException,
284284 contentLength ,
285285 contentEncoding );
286286 return ;
287+ } catch (InterruptedException e ) {
288+ throw e ;
287289 } catch (FileNotFoundException ex ) {
288290 LOG .warning ("Failed to download " + uri + ", not found" + (redirects == null ? "" : ", redirects: " + redirects ), ex );
289291 throw toDownloadException (uri , ex , exceptions ); // we will not try this URL again
290- } catch (IOException ex ) {
292+ } catch (Exception ex ) {
291293 if (exceptions == null )
292294 exceptions = new ArrayList <>();
293295
@@ -301,7 +303,7 @@ private void downloadHttp(URI uri, boolean checkETag) throws DownloadException,
301303 }
302304
303305 private void downloadNotHttp (URI uri ) throws DownloadException , InterruptedException {
304- ArrayList <IOException > exceptions = null ;
306+ ArrayList <Exception > exceptions = null ;
305307 for (int retryTime = 0 ; retryTime < retry ; retryTime ++) {
306308 if (isCancelled ()) {
307309 throw new InterruptedException ();
@@ -317,11 +319,13 @@ private void downloadNotHttp(URI uri) throws DownloadException, InterruptedExcep
317319 conn .getContentLengthLong (),
318320 ContentEncoding .fromConnection (conn ));
319321 return ;
322+ } catch (InterruptedException e ) {
323+ throw e ;
320324 } catch (FileNotFoundException ex ) {
321325 LOG .warning ("Failed to download " + uri + ", not found" , ex );
322326
323327 throw toDownloadException (uri , ex , exceptions ); // we will not try this URL again
324- } catch (IOException ex ) {
328+ } catch (Exception ex ) {
325329 if (exceptions == null )
326330 exceptions = new ArrayList <>();
327331
@@ -333,7 +337,7 @@ private void downloadNotHttp(URI uri) throws DownloadException, InterruptedExcep
333337 throw toDownloadException (uri , null , exceptions );
334338 }
335339
336- private static DownloadException toDownloadException (URI uri , @ Nullable IOException last , @ Nullable ArrayList <IOException > exceptions ) {
340+ private static DownloadException toDownloadException (URI uri , @ Nullable Exception last , @ Nullable ArrayList <Exception > exceptions ) {
337341 if (exceptions == null || exceptions .isEmpty ()) {
338342 return new DownloadException (uri , last != null
339343 ? last
@@ -342,7 +346,7 @@ private static DownloadException toDownloadException(URI uri, @Nullable IOExcept
342346 if (last == null )
343347 last = exceptions .remove (exceptions .size () - 1 );
344348
345- for (IOException e : exceptions ) {
349+ for (Exception e : exceptions ) {
346350 last .addSuppressed (e );
347351 }
348352 return new DownloadException (uri , last );
0 commit comments