mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-01-20 09:53:13 +00:00
Simplified SystemSchema load process
This commit is contained in:
@@ -66,20 +66,12 @@ public final class SystemSchema {
|
||||
|
||||
private static InputStream getResourceAsStream(final String name) throws IOException {
|
||||
|
||||
final CodeSource codeSource = SystemSchema.class.getProtectionDomain().getCodeSource();
|
||||
final ClassLoader classLoader = SystemSchema.class.getClassLoader();
|
||||
final String location = codeSource.getLocation().toString();
|
||||
final Enumeration<URL> urls;
|
||||
InputStream inputStream = SystemSchema.class.getClassLoader().getResourceAsStream(name);
|
||||
|
||||
urls = classLoader.getResources(name);
|
||||
|
||||
while (urls.hasMoreElements()) {
|
||||
final URL url = urls.nextElement();
|
||||
if (url.getFile().endsWith(name)) {
|
||||
return url.openStream();
|
||||
}
|
||||
if (inputStream != null) {
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
throw new FileNotFoundException(lenientFormat("cannot find %s at %s", name, location));
|
||||
throw new FileNotFoundException(lenientFormat("cannot find %s", name));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user