hapi-hl7v2
hapi-hl7v2 copied to clipboard
HL7overHttp
In the class 'AbstractHl7OverHttpDecoder'
method
'private String readLine(InputStream theInputStream, boolean theFirstLine)'
in the return statement
'return WHITESPACE_PATTERN.matcher(retVal.toString()).replaceAll(" ").trim();'
the result is trimmed this gives problems in the code class 'Hl7OverHttpResponseDecoder'
in the method 'readActionLineAndDecode' code
' String statusPart = firstLine.substring(9);
int spaceIdx = statusPart.indexOf(' ');
if (spaceIdx == -1) {
throw new DecodeException("Invalid response line, no space after status code. Line is: " + firstLine);
}
because the last ' ' is removed by the trim in the readLine, so always an error is thrown.
Removing the trim solves the problem for me.