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

Strange error on \\("") #251

Closed
ashawley opened this issue Aug 16, 2018 · 0 comments
Closed

Strange error on \\("") #251

ashawley opened this issue Aug 16, 2018 · 0 comments
Milestone

Comments

@ashawley
Copy link
Member

Trying to match the empty string on descendants (or self) throws an unexpected error:

scala> <x/> \\ ""
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:646)
at scala.collection.immutable.StringOps$.apply$extension(StringOps.scala:37)
at scala.xml.NodeSeq.$bslash$bslash(NodeSeq.scala:147)
...

The error should be consistent with what is thrown when trying to match the empty string on just children:

scala> <x/> \ ""
java.lang.IllegalArgumentException
at scala.xml.NodeSeq.fail$1(NodeSeq.scala:97)
at scala.xml.NodeSeq.$bslash(NodeSeq.scala:120)
...

This was identified while writing ScalaCheck property tests in #110.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant