diff --git a/src/main/java/com/ctc/wstx/io/ISOLatinReader.java b/src/main/java/com/ctc/wstx/io/ISOLatinReader.java index 1c7b50a4..e233d1d9 100644 --- a/src/main/java/com/ctc/wstx/io/ISOLatinReader.java +++ b/src/main/java/com/ctc/wstx/io/ISOLatinReader.java @@ -111,7 +111,7 @@ public int read(char[] cbuf, int start, int len) throws IOException if (c <= 0x9F) { if (c == 0x85) { // NEL, let's convert? c = CONVERT_NEL_TO; - } else if (c >= 0x7F) { // DEL, ctrl chars + } else { // DEL, ctrl chars int pos = mByteCount + i; reportInvalidXml11(c, pos, pos); } diff --git a/src/main/java/com/ctc/wstx/sr/StreamScanner.java b/src/main/java/com/ctc/wstx/sr/StreamScanner.java index 3e402e54..37845436 100644 --- a/src/main/java/com/ctc/wstx/sr/StreamScanner.java +++ b/src/main/java/com/ctc/wstx/sr/StreamScanner.java @@ -1334,9 +1334,8 @@ protected int resolveCharOnlyEntity(boolean checkStd) * the entity), so let's push it back first */ --mInputPtr; - /* Shortest valid reference would be 3 chars ('&a;'); which - * would only be legal from an expanded entity... - */ + // Shortest valid reference would be 3 chars ('&a;'); which + // would only be legal from an expanded entity... if (!ensureInput(6)) { avail = inputInBuffer(); if (avail < 3) { @@ -1349,9 +1348,8 @@ protected int resolveCharOnlyEntity(boolean checkStd) ++mInputPtr; } - /* Ok, now we have one more character to check, and that's enough - * to determine type decisively. - */ + // Ok, now we have one more character to check, and that's enough + // to determine type decisively. char c = mInputBuffer[mInputPtr]; // A char reference? @@ -1381,15 +1379,15 @@ protected int resolveCharOnlyEntity(boolean checkStd) } } } else if (c == 'l') { - if (avail >= 3 - && mInputBuffer[mInputPtr+1] == 't' + // guaranteed at least 3 minimum so + if (mInputBuffer[mInputPtr+1] == 't' && mInputBuffer[mInputPtr+2] == ';') { mInputPtr += 3; return '<'; } } else if (c == 'g') { - if (avail >= 3 - && mInputBuffer[mInputPtr+1] == 't' + // guaranteed at least 3 minimum so + if (mInputBuffer[mInputPtr+1] == 't' && mInputBuffer[mInputPtr+2] == ';') { mInputPtr += 3; return '>'; @@ -1474,14 +1472,14 @@ protected EntityDecl resolveNonCharEntity() } } } else if (c == 'l') { - if (avail >= 3 - && mInputBuffer[mInputPtr+1] == 't' + // guaranteed at least 3 minimum so + if (mInputBuffer[mInputPtr+1] == 't' && mInputBuffer[mInputPtr+2] == ';') { return null; } } else if (c == 'g') { - if (avail >= 3 - && mInputBuffer[mInputPtr+1] == 't' + // guaranteed at least 3 minimum so + if (mInputBuffer[mInputPtr+1] == 't' && mInputBuffer[mInputPtr+2] == ';') { return null; } @@ -2229,9 +2227,6 @@ protected final String parsePublicId(char quoteChar, String errorMsg) * white space, and coalescing remaining ws into single spaces. */ if (spaceToAdd) { // pending white space to add? - if (c == CHAR_SPACE) { // still a space; let's skip - continue; - } /* ok: if we have non-space, we'll either forget about * space(s) (if nothing has been output, ie. leading space), * or output a single space (in-between non-white space)