Merge pull request #4582 from tsachev/gh-4557

* pr/4582:
  Use fast exceptions in findResource(s)
This commit is contained in:
Stephane Nicoll 2015-11-30 09:57:39 +01:00
commit 5beeaf1760
1 changed files with 15 additions and 3 deletions

View File

@ -82,8 +82,14 @@ public class LaunchedURLClassLoader extends URLClassLoader {
if (name.equals("") && hasURLs()) {
return getURLs()[0];
}
Handler.setUseFastConnectionExceptions(true);
try {
return super.findResource(name);
}
finally {
Handler.setUseFastConnectionExceptions(false);
}
}
catch (IllegalArgumentException ex) {
return null;
}
@ -94,8 +100,14 @@ public class LaunchedURLClassLoader extends URLClassLoader {
if (name.equals("") && hasURLs()) {
return Collections.enumeration(Arrays.asList(getURLs()));
}
Handler.setUseFastConnectionExceptions(true);
try {
return super.findResources(name);
}
finally {
Handler.setUseFastConnectionExceptions(false);
}
}
private boolean hasURLs() {
return getURLs().length > 0;
@ -291,6 +303,6 @@ public class LaunchedURLClassLoader extends URLClassLoader {
return this.localResources.nextElement();
}
};
}
}