KB Article #176849

StringIndexOutOfBoundsException in Get Cookie filter when cookie does not contain a semicolon

Problem

-- When the cookie value does not contain a semicolon, the Get Cookie filter aborts with a stack trace similar to:

Found Set-Cookie Header: Set-Cookie:sample=test

java exception: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1911)
at com.vordel.circuit.cookie.HttpCookie.parseSetCookie(HttpCookie.java:201)
at com.vordel.circuit.cookie.HttpCookie.parse(HttpCookie.java:330)
at com.vordel.circuit.cookie.RetrieveCookiesProcessor.invoke(RetrieveCookiesProcessor.java:64)
at com.vordel.circuit.InvocationEngine.invokeFilter(InvocationEngine.java:150)
at com.vordel.circuit.InvocationEngine.invokeCircuit(InvocationEngine.java:42)
at com.vordel.circuit.InvocationEngine.recordCircuitInvocation(InvocationEngine.java:276)
at com.vordel.circuit.InvocationEngine.processMessage(InvocationEngine.java:239)
at com.vordel.circuit.SyntheticCircuitChainProcessor.invoke(SyntheticCircuitChainProcessor.java:64)
at com.vordel.dwe.http.HTTPPlugin.processRequest(HTTPPlugin.java:350)
at com.vordel.dwe.http.HTTPPlugin.invokeDispose(HTTPPlugin.java:358)
at com.vordel.dwe.http.HTTPPlugin.invoke(HTTPPlugin.java:135)

Resolution

-- To work around this, use the Retrieve from HTTP Header to retrieve the Set-Cookie header.