Commit 389cdce
committed
Fix failure for empty string match
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.1 parent f3841aa commit 389cdce
File tree
2 files changed
+12
-0
lines changed2 files changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
| |||
0 commit comments