Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report the correct error position in some malformed constructs. #1253

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/jsoup/parser/CharacterReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class CharacterReader {
static final char EOF = (char) -1;
private static final int maxStringCacheLen = 12;
static final int maxBufferLen = 1024 * 32; // visible for testing
private static final int readAheadLimit = (int) (maxBufferLen * 0.75);
static final int readAheadLimit = (int) (maxBufferLen * 0.75); // visible for testing

private final char[] charBuf;
private final Reader reader;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jsoup/parser/TokeniserState.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ void read(Tokeniser t, CharacterReader r) {
t.transition(SelfClosingStartTag);
break;
case '<': // NOTE: out of spec, but clear author intent
t.error(this);
r.unconsume();
t.error(this);
// intended fall through to next >
case '>':
t.emitTagPending();
Expand Down Expand Up @@ -565,8 +565,8 @@ void read(Tokeniser t, CharacterReader r) {
t.transition(SelfClosingStartTag);
break;
case '<': // NOTE: out of spec, but clear (spec has this as a part of the attribute name)
t.error(this);
r.unconsume();
t.error(this);
csaboka marked this conversation as resolved.
Show resolved Hide resolved
// intended fall through as if >
case '>':
t.emitTagPending();
Expand Down Expand Up @@ -873,8 +873,8 @@ void read(Tokeniser t, CharacterReader r) {
t.transition(Data);
break;
default:
t.error(this);
r.unconsume();
t.error(this);
t.transition(BeforeAttributeName);
}

Expand All @@ -894,8 +894,8 @@ void read(Tokeniser t, CharacterReader r) {
t.transition(Data);
break;
default:
t.error(this);
r.unconsume();
t.error(this);
t.transition(BeforeAttributeName);
}
}
Expand Down
Loading