Skip to content

regression: IOException: Mark invalid after upgrade to 1.12.2 #1324

@surli

Description

@surli

Hi,

we are using jsoup inside XWiki to perform some page validation as part of our integrations tests and we noticed a regression after the upgrade from jsoup 1.12.1 to 1.12.2. When accessing a particular page, we obtained the following:

Exception in thread "main" java.io.IOException: Mark invalid
	at org.jsoup.parser.CharacterReader.rewindToMark(CharacterReader.java:148)
	at org.jsoup.parser.Tokeniser.consumeCharacterReference(Tokeniser.java:192)
	at org.jsoup.parser.TokeniserState$38.read(TokeniserState.java:759)
	at org.jsoup.parser.Tokeniser.read(Tokeniser.java:59)
	at org.jsoup.parser.TreeBuilder.runParser(TreeBuilder.java:55)
	at org.jsoup.parser.TreeBuilder.parse(TreeBuilder.java:47)
	at org.jsoup.parser.Parser.parseInput(Parser.java:35)
	at org.jsoup.helper.DataUtil.parseInputStream(DataUtil.java:170)
	at org.jsoup.helper.DataUtil.load(DataUtil.java:66)
	at org.jsoup.Jsoup.parse(Jsoup.java:118)
	at Main.main(Main.java:47)

I've been able to isolate and reproduce in a "small" setup, but it still needs an XWiki instance.
Here's the small Java code I'm using for reproduction:

GetMethod method = new GetMethod("http://127.0.0.1:8080/xwiki/bin/admin/XWiki/XWikiPreferences?editor=globaladmin&section=Groups");
method.setFollowRedirects(true);
method.getParams().setSoTimeout(30000);
method.setDoAuthentication(true);
method.addRequestHeader("Authorization","Basic " + new String(Base64.encodeBase64("Admin:admin".getBytes())));
new HttpClient().executeMethod(method);
byte[] response = method.getResponseBody();
method.releaseConnection();

Jsoup.parse(new ByteArrayInputStream(response), null, "");

Before running this, you need to download an instance of XWiki 12.0 (http://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-distribution-flavor-jetty-hsqldb/12.0/xwiki-platform-distribution-flavor-jetty-hsqldb-12.0.zip), unzip it, start it using the bash script (./start_xwiki.sh) and open a browser with http://localhost:8080 to be sure everything's loaded.

I checked with 1.12.1 and I confirm I didn't reproduce with it.

Metadata

Metadata

Assignees

Labels

bugA confirmed bug, that we should fixfixedAn {bug|improvement} that has been {fixed|implemented}

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions