Merge pull request #4582 from tsachev/gh-4557
* pr/4582: Use fast exceptions in findResource(s)
This commit is contained in:
commit
5beeaf1760
|
@ -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();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue