mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-01-25 12:23:15 +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 {
|
private static InputStream getResourceAsStream(final String name) throws IOException {
|
||||||
|
|
||||||
final CodeSource codeSource = SystemSchema.class.getProtectionDomain().getCodeSource();
|
InputStream inputStream = SystemSchema.class.getClassLoader().getResourceAsStream(name);
|
||||||
final ClassLoader classLoader = SystemSchema.class.getClassLoader();
|
|
||||||
final String location = codeSource.getLocation().toString();
|
|
||||||
final Enumeration<URL> urls;
|
|
||||||
|
|
||||||
urls = classLoader.getResources(name);
|
if (inputStream != null) {
|
||||||
|
return inputStream;
|
||||||
while (urls.hasMoreElements()) {
|
|
||||||
final URL url = urls.nextElement();
|
|
||||||
if (url.getFile().endsWith(name)) {
|
|
||||||
return url.openStream();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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