Skip to content

Strange error on \\("") #251

Closed
Closed
@ashawley

Description

@ashawley

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions