Merge branch '1.5.x'

This commit is contained in:
Phillip Webb
2017-07-24 13:02:12 -07:00
9 changed files with 170 additions and 128 deletions

View File

@@ -71,8 +71,6 @@ public class Handler extends URLStreamHandler {
rootFileCache = new SoftReference<>(null);
}
private final Logger logger = Logger.getLogger(getClass().getName());
private final JarFile jarFile;
private URLStreamHandler fallbackHandler;
@@ -105,10 +103,10 @@ public class Handler extends URLStreamHandler {
}
catch (Exception ex) {
if (reason instanceof IOException) {
this.logger.log(Level.FINEST, "Unable to open fallback handler", ex);
log(false, "Unable to open fallback handler", ex);
throw (IOException) reason;
}
this.logger.log(Level.WARNING, "Unable to open fallback handler", ex);
log(true, "Unable to open fallback handler", ex);
if (reason instanceof RuntimeException) {
throw (RuntimeException) reason;
}
@@ -116,6 +114,18 @@ public class Handler extends URLStreamHandler {
}
}
private void log(boolean warning, String message, Exception cause) {
try {
Logger.getLogger(getClass().getName())
.log((warning ? Level.WARNING : Level.FINEST), message, cause);
}
catch (Exception ex) {
if (warning) {
System.err.println("WARNING: " + message);
}
}
}
private URLStreamHandler getFallbackHandler() {
if (this.fallbackHandler != null) {
return this.fallbackHandler;