Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.7.3
-
None
-
None
Description
I am encountering another parser "bug"
does not work:
def params = new Expando() params.newValue = 23 def trendMap = ['worsening': (-2), 'slightly worsening':(-1), 'neutral':0 ,'slightly improving': 1,'improving':2] def obj = [] def el = [obj] if (!el[1]) el[1] = "1" Eval.x(el[0],"x[1]="+ el[2] ? trendMap[params.newValue.toInteger()] : params.newValue.toInteger() )
changing the last line to include brackets makes it work
Eval.x(el[0],"x[1]="+ (el[2] ? trendMap[params.newValue.toInteger()] : params.newValue.toInteger()) )
Exception thrown
BUG! exception in phase 'parsing' in source unit 'Script1.groovy' null
at groovy.util.Eval.me(Eval.java:50)
at groovy.util.Eval.x(Eval.java:60)
at groovy.util.Eval$x.call(Unknown Source)
at ConsoleScript24.run(ConsoleScript24:9)
Caused by: java.lang.NullPointerException
at java.io.StringReader.<init>(StringReader.java:33)
... 4 more
Result: 23
Exception thrown
BUG! exception in phase 'parsing' in source unit 'Script1.groovy' null
at groovy.util.Eval.me(Eval.java:50)
at groovy.util.Eval.x(Eval.java:60)
at groovy.util.Eval$x.call(Unknown Source)
at ConsoleScript26.run(ConsoleScript26:9)
Caused by: java.lang.NullPointerException
at java.io.StringReader.<init>(StringReader.java:33)
... 4 more