Kaydet (Commit) d79ce8ba authored tarafından Stephan Bergmann's avatar Stephan Bergmann

cid#1326441,1326442,1326392: Dereference null return value

...replacing implicit NullPointerException/IndexOutOfBoundsException with
explicit RuntimeException

Change-Id: I519b0fcd2b2d2657ae82ef7eb28f88a0e13fa970
üst 3e945cbd
......@@ -124,8 +124,18 @@ final class Unmarshal {
return TypeDescription.getTypeDescription(typeClass);
} else {
int index = read16Bit();
TypeDescription type = null;
if ((b & 0x80) != 0) {
TypeDescription type;
if ((b & 0x80) == 0) {
if (index >= typeCache.length) {
throw new RuntimeException(
"Reading TYPE with bad cache index " + index);
}
type = typeCache[index];
if (type == null) {
throw new RuntimeException(
"Reading TYPE with empty cache index " + index);
}
} else {
try {
type = TypeDescription.getTypeDescription(
readStringValue());
......@@ -134,11 +144,11 @@ final class Unmarshal {
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
if (index != 0xFFFF) {
if ((b & 0x80) == 0) {
type = typeCache[index];
} else {
if (index != 0xFFFF) {
if (index >= typeCache.length) {
throw new RuntimeException(
"Reading TYPE with bad cache index " + index);
}
typeCache[index] = type;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment