Merge pull request #4582 from tsachev/gh-4557
* pr/4582: Use fast exceptions in findResource(s)
This commit is contained in:
commit
5beeaf1760
|
@ -82,7 +82,13 @@ public class LaunchedURLClassLoader extends URLClassLoader {
|
||||||
if (name.equals("") && hasURLs()) {
|
if (name.equals("") && hasURLs()) {
|
||||||
return getURLs()[0];
|
return getURLs()[0];
|
||||||
}
|
}
|
||||||
return super.findResource(name);
|
Handler.setUseFastConnectionExceptions(true);
|
||||||
|
try {
|
||||||
|
return super.findResource(name);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Handler.setUseFastConnectionExceptions(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -94,7 +100,13 @@ public class LaunchedURLClassLoader extends URLClassLoader {
|
||||||
if (name.equals("") && hasURLs()) {
|
if (name.equals("") && hasURLs()) {
|
||||||
return Collections.enumeration(Arrays.asList(getURLs()));
|
return Collections.enumeration(Arrays.asList(getURLs()));
|
||||||
}
|
}
|
||||||
return super.findResources(name);
|
Handler.setUseFastConnectionExceptions(true);
|
||||||
|
try {
|
||||||
|
return super.findResources(name);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Handler.setUseFastConnectionExceptions(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasURLs() {
|
private boolean hasURLs() {
|
||||||
|
@ -291,6 +303,6 @@ public class LaunchedURLClassLoader extends URLClassLoader {
|
||||||
return this.localResources.nextElement();
|
return this.localResources.nextElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue