diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-02-24 10:46:36 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-02-24 11:33:50 +0100 |
commit | d79ce8ba8f9e2411ab70b5c9d2ea0bb6b4f4e84e (patch) | |
tree | 2cc5427536fc2365796c0162ffc6f31d8027a5f2 /jurt | |
parent | 3e945cbd9b23a98d22065f1593295a7afa410c9e (diff) |
cid#1326441,1326442,1326392: Dereference null return value
...replacing implicit NullPointerException/IndexOutOfBoundsException with
explicit RuntimeException
Change-Id: I519b0fcd2b2d2657ae82ef7eb28f88a0e13fa970
Diffstat (limited to 'jurt')
-rw-r--r-- | jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index a2681b09dc8a..c8d14e9d0c35 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -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; } } |