Fixed java hybrid row deserialization bug (#4)

This commit is contained in:
Mohammad Derakhshani
2019-11-14 13:53:36 -08:00
committed by David Noble
parent 73fddf4f90
commit 11aad4bbbe
2 changed files with 6 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import it.unimi.dsi.fastutil.HashCommon;
import it.unimi.dsi.fastutil.ints.Int2ReferenceMap;
import it.unimi.dsi.fastutil.ints.Int2ReferenceMaps;
import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap;
import javax.annotation.Nonnull;
@@ -38,7 +39,7 @@ public final class SchemaId implements Comparable<SchemaId> {
private static final Int2ReferenceMap<SchemaId> cache;
static {
cache = new Int2ReferenceOpenHashMap<>();
cache = Int2ReferenceMaps.synchronize(new Int2ReferenceOpenHashMap<>());
cache.put(0, INVALID = NONE = new SchemaId(0));
}

View File

@@ -65,21 +65,12 @@ public final class SystemSchema {
}
private static InputStream getResourceAsStream(final String name) throws IOException {
InputStream inputStream = SystemSchema.class.getClassLoader().getResourceAsStream(name);
final CodeSource codeSource = SystemSchema.class.getProtectionDomain().getCodeSource();
final ClassLoader classLoader = SystemSchema.class.getClassLoader();
final String location = codeSource.getLocation().toString();
final Enumeration<URL> urls;
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));
}
}