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

cid#1326391: Dereference null return value

...replacing implicit NullPointerException with explicit IOException

Change-Id: I673c836c64e141a7a3e4b40fca0922feee26bd03
üst d79ce8ba
...@@ -398,14 +398,16 @@ public final class urp implements IProtocol { ...@@ -398,14 +398,16 @@ public final class urp implements IProtocol {
return readRequest(funId, sync); return readRequest(funId, sync);
} }
private UrpMessage readShortRequest(int header) { private UrpMessage readShortRequest(int header) throws IOException {
int funId = (header & HEADER_FUNCTIONID14) != 0 int funId = (header & HEADER_FUNCTIONID14) != 0
? ((header & HEADER_FUNCTIONID) << 8) | unmarshal.read8Bit() ? ((header & HEADER_FUNCTIONID) << 8) | unmarshal.read8Bit()
: header & HEADER_FUNCTIONID; : header & HEADER_FUNCTIONID;
return readRequest(funId, false); return readRequest(funId, false);
} }
private UrpMessage readRequest(int functionId, boolean forcedSynchronous) { private UrpMessage readRequest(int functionId, boolean forcedSynchronous)
throws IOException
{
boolean internal = PROPERTIES_OID.equals(inL1Oid); boolean internal = PROPERTIES_OID.equals(inL1Oid);
// inL1Oid may be null in XInstanceProvider.getInstance("") // inL1Oid may be null in XInstanceProvider.getInstance("")
XCurrentContext cc = XCurrentContext cc =
...@@ -415,6 +417,10 @@ public final class urp implements IProtocol { ...@@ -415,6 +417,10 @@ public final class urp implements IProtocol {
new Type(XCurrentContext.class)) new Type(XCurrentContext.class))
: null; : null;
IMethodDescription desc = inL1Type.getMethodDescription(functionId); IMethodDescription desc = inL1Type.getMethodDescription(functionId);
if (desc == null) {
throw new IOException(
"read URP request with unsupported function ID " + functionId);
}
ITypeDescription[] inSig = desc.getInSignature(); ITypeDescription[] inSig = desc.getInSignature();
ITypeDescription[] outSig = desc.getOutSignature(); ITypeDescription[] outSig = desc.getOutSignature();
Object[] args = new Object[inSig.length]; Object[] args = new Object[inSig.length];
......
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