diff --git a/commons-serialize-xml/src/main/java/io/gitlab/jfronny/commons/serialize/xml/impl/BaseXmlReader.java b/commons-serialize-xml/src/main/java/io/gitlab/jfronny/commons/serialize/xml/impl/BaseXmlReader.java index 3429ef1..65e5d61 100644 --- a/commons-serialize-xml/src/main/java/io/gitlab/jfronny/commons/serialize/xml/impl/BaseXmlReader.java +++ b/commons-serialize-xml/src/main/java/io/gitlab/jfronny/commons/serialize/xml/impl/BaseXmlReader.java @@ -263,13 +263,13 @@ public class BaseXmlReader implements Closeable { if (c == -1) { throw syntaxError("Unterminated tag"); } else if (c == '<') { - if (pos + 1 <= limit || fillBuffer(2)) { - char chNext = buffer[pos + 1]; + if (pos + 1 <= limit || fillBuffer(1)) { + char chNext = buffer[pos]; if (chNext == '/') { pos++; return peeked = PEEKED_END_TAG; } else if (chNext == '!') { - if (pos + 8 <= limit || fillBuffer(9)) { + if (pos + 9 <= limit || fillBuffer(9)) { if (buffer[pos + 2] == '[' && buffer[pos + 3] == 'C' && buffer[pos + 4] == 'D' && buffer[pos + 5] == 'A' && buffer[pos + 6] == 'T' && buffer[pos + 7] == 'A' && buffer[pos + 8] == '[') { pos += 9; return peeked = PEEKED_CDATA; @@ -277,15 +277,15 @@ public class BaseXmlReader implements Closeable { throw syntaxError("Expected = limit || fillBuffer(3)) { - var check = isNameStart(chNext, buffer[pos + 2]); + } else if (pos + 2 <= limit || fillBuffer(2)) { + var check = isNameStart(chNext, buffer[pos + 1]); if (check != NameCheck.NONE) { pos++; return peeked = PEEKED_BEGIN_TAG; } } } - throw syntaxError("Unterminated tag at " + c); + throw syntaxError("Unterminated tag"); } else { return peeked = PEEKED_TEXT; }