diff --git a/src/java/org/jivesoftware/multiplexer/net/XMLLightweightParser.java b/src/java/org/jivesoftware/multiplexer/net/XMLLightweightParser.java index 0339e6c..54ae0b7 100644 --- a/src/java/org/jivesoftware/multiplexer/net/XMLLightweightParser.java +++ b/src/java/org/jivesoftware/multiplexer/net/XMLLightweightParser.java @@ -156,14 +156,20 @@ // Verify if the last received byte is an incomplete double byte character char lastChar = buf[readByte-1]; - if (Character.isISOControl(lastChar) || lastChar >= 0xfff0) { + if (lastChar >= 0xfff0) { + if (Log.isDebugEnabled()) { Log.debug("Waiting to get complete char: " + String.valueOf(buf)); + } // Rewind the position one place so the last byte stays in the buffer // The missing byte should arrive in the next iteration. Once we have both // of bytes we will have the correct character byteBuffer.position(byteBuffer.position()-1); // Decrease the number of bytes read by one readByte--; + // Just return if nothing was read + if (readByte == 0) { + return; + } } buffer.append(buf, 0, readByte);