XML.fromString(xmlString) throws StackOverflowException #75

Closed
eirirlar opened this Issue Nov 28, 2011 · 3 comments

Projects

None yet

2 participants

Using anti-xml 0.2 with scala 2.9.1.

val xmlString = new Scanner(this.getClass.getClassLoader.getResourceAsStream(thefilestring), "UTF-8").useDelimiter("\A").next
val xml = XML.fromString(xmlString)

The above throws StackOverflowException on certain files like the one linked to below.

java.lang.StackOverflowError
at java.util.regex.Pattern$Loop.match(Pattern.java:4683)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$BranchConn.match(Pattern.java:4466)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3694)
at java.util.regex.Pattern$Branch.match(Pattern.java:4502)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$Loop.match(Pattern.java:4683)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$BranchConn.match(Pattern.java:4466)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3694)
at java.util.regex.Pattern$Branch.match(Pattern.java:4502)
...

See this link for an example file that triggers this exception.

http://pastebin.com/5CmM8SY3

@djspiewak djspiewak added a commit that referenced this issue Dec 11, 2011
@djspiewak djspiewak Added spec for issue #75 5ef9058
Owner

I added a spec for this issue and was unable to dup the error. Have you tried with version 0.3? Version 0.2 is a little outdated. Also, the stack overflow in this case looks more like it's coming from Scanner than from XML, but I may be mistaken there.

@djspiewak djspiewak closed this Dec 11, 2011

This is strange. I've rewritten my test to remove the Scanner \A inputstream thing:

val path = Paths.get(getClass.getProtectionDomain.getCodeSource.getLocation.toURI).resolve("jira-rss-derby-project.xml")
val string = new String(Files.readAllBytes(path),"UTF-8")
println(string)

// val xml = com.codecommit.antixml.XML.fromString(string)
// println(xml)

This runs fine on my system. However, when I comment back in the two last lines, I get the stackoverflowexception (every time).

I run this on antixml 0.3, ubuntu 11.10 32bit, java sdk 7.01 32bit, scala 2.9.1, intellij idea 11 with idea.vmoptions:
-Xms256m
-Xmx1024m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=256m
-ea

Regards, Eirik

Owner

Can you try running the Anti-XML test suite? You can do test-only *XMLSpecs to just get my version of your test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment