Dangling meta character '' near index 0
^
at java.util.regex.Pattern.error(Pattern.java:1713)
at java.util.regex.Pattern.sequence(Pattern.java:1878)
at java.util.regex.Pattern.expr(Pattern.java:1752)
at java.util.regex.Pattern.compile(Pattern.java:1460)
at java.util.regex.Pattern.(Pattern.java:1133)
at java.util.regex.Pattern.compile(Pattern.java:823)
at java.util.regex.Pattern.matches(Pattern.java:928)
at java.lang.String.matches(String.java:2090)
at uk.gov.tna.dri.schema.RegexRule.valid(Rule.scala:158)
at uk.gov.tna.dri.schema.Rule.evaluate(Rule.scala:34)
at uk.gov.tna.dri.schema.IfRule$$anonfun$5.apply(Rule.scala:131)
at uk.gov.tna.dri.schema.IfRule$$anonfun$5.apply(Rule.scala:130)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at uk.gov.tna.dri.schema.IfRule.evaluate(Rule.scala:130)
This implies that the problem with the regular expression syntax is not caught at Schema parse time, but is unexpectedly found at evaluation time.
However if you use the CSVS file -
version 1.0
@totalColumns 3
col1: is("v1")
col2: regex("*")
col3: is("v3")
The problem with the regular expression syntax is caught at Schema parse time. Therefore the issue seems to be with using invalid regular expressions inside conditional statements like 'if'.
Using the CSV file -
col1,col2,col3 v1,v2,v3
Using the CSVS file -
version 1.0 @totalColumns 3 col1: is("v1") col2: if(is("v8"), is("v2"), regex("*")) col3: is("v3")
Results in the stack trace at runtime -
Dangling meta character '' near index 0 ^ at java.util.regex.Pattern.error(Pattern.java:1713) at java.util.regex.Pattern.sequence(Pattern.java:1878) at java.util.regex.Pattern.expr(Pattern.java:1752) at java.util.regex.Pattern.compile(Pattern.java:1460) at java.util.regex.Pattern.(Pattern.java:1133)
at java.util.regex.Pattern.compile(Pattern.java:823)
at java.util.regex.Pattern.matches(Pattern.java:928)
at java.lang.String.matches(String.java:2090)
at uk.gov.tna.dri.schema.RegexRule.valid(Rule.scala:158)
at uk.gov.tna.dri.schema.Rule.evaluate(Rule.scala:34)
at uk.gov.tna.dri.schema.IfRule$$anonfun$5.apply(Rule.scala:131)
at uk.gov.tna.dri.schema.IfRule$$anonfun$5.apply(Rule.scala:130)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at uk.gov.tna.dri.schema.IfRule.evaluate(Rule.scala:130)
This implies that the problem with the regular expression syntax is not caught at Schema parse time, but is unexpectedly found at evaluation time.
However if you use the CSVS file -
version 1.0 @totalColumns 3 col1: is("v1") col2: regex("*") col3: is("v3")
The problem with the regular expression syntax is caught at Schema parse time. Therefore the issue seems to be with using invalid regular expressions inside conditional statements like 'if'.