KB Article #179355

ICAP filter reports NullPointerException in RESPMOD mode

Problem

An ICAP filter reports an NPE similar to the following when sending a RESPMOD request:


ERROR 1/17/18, 12:00:10.631 Filter 'ICAP' Status: ABORTED
ERROR 1/17/18, 12:00:10.631 }
ERROR 1/17/18, 12:00:10.631 nested fault: null:
java.lang.NullPointerException
at com.vordel.circuit.icap.IcapProcessor$ICAPState.getResponseLine(IcapProcessor.java:218)
at com.vordel.circuit.icap.IcapProcessor$ICAPState.forwardClientRequest(IcapProcessor.java:107)
at com.vordel.circuit.icap.IcapProcessor$ICAPState.doTransaction(IcapProcessor.java:51)
at com.vordel.circuit.icap.IcapProcessor.invoke(IcapProcessor.java:253)
at com.vordel.circuit.InvocationEngine.invokeFilter(InvocationEngine.java:151)
at com.vordel.circuit.InvocationEngine.invokeCircuit(InvocationEngine.java:43)
at com.vordel.circuit.InvocationEngine.recordCircuitInvocation(InvocationEngine.java:277)
at com.vordel.circuit.InvocationEngine.processMessage(InvocationEngine.java:240)
at com.vordel.circuit.SyntheticCircuitChainProcessor.invoke(SyntheticCircuitChainProcessor.java:65)
at com.vordel.dwe.http.HTTPPlugin.processRequest(HTTPPlugin.java:412)
at com.vordel.dwe.http.HTTPPlugin.invokeDispose(HTTPPlugin.java:431)
at com.vordel.dwe.http.HTTPPlugin.invoke(HTTPPlugin.java:143)


Resolution


This happens when your flow is wrong for RESPMOD. In the RESPMOD flow, you go to some remote server to get a response, then run the ICAP filter on said response. The NPE described here happens because you have written a flow that doesn't do a request, so certain data about the request that never happened does not exist. Specifically, the values for http.response.version, http.response.status & http.response.info are missing, which would normally indicate the version of HTTP used (1.0 or 1.1), as well as the status code and the info string for that status code, e.g. "200" and "OK". In general, the proper fix would be to use REQMOD for this flow.