mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-01-26 04:43:17 +00:00
Fixed java hybrid row deserialization bug (#4)
This commit is contained in:
committed by
David Noble
parent
73fddf4f90
commit
11aad4bbbe
@@ -14,6 +14,7 @@ import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
|||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
||||||
import it.unimi.dsi.fastutil.HashCommon;
|
import it.unimi.dsi.fastutil.HashCommon;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ReferenceMap;
|
import it.unimi.dsi.fastutil.ints.Int2ReferenceMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ReferenceMaps;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@@ -38,7 +39,7 @@ public final class SchemaId implements Comparable<SchemaId> {
|
|||||||
private static final Int2ReferenceMap<SchemaId> cache;
|
private static final Int2ReferenceMap<SchemaId> cache;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
cache = new Int2ReferenceOpenHashMap<>();
|
cache = Int2ReferenceMaps.synchronize(new Int2ReferenceOpenHashMap<>());
|
||||||
cache.put(0, INVALID = NONE = new SchemaId(0));
|
cache.put(0, INVALID = NONE = new SchemaId(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,21 +65,12 @@ public final class SystemSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static InputStream getResourceAsStream(final String name) throws IOException {
|
private static InputStream getResourceAsStream(final String name) throws IOException {
|
||||||
|
InputStream inputStream = SystemSchema.class.getClassLoader().getResourceAsStream(name);
|
||||||
|
|
||||||
final CodeSource codeSource = SystemSchema.class.getProtectionDomain().getCodeSource();
|
if (inputStream != null) {
|
||||||
final ClassLoader classLoader = SystemSchema.class.getClassLoader();
|
return inputStream;
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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