Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
Description
The following jelly script:
<jelly xmlns="jelly:core" xmlns:log="jelly:log" xmlns:bsh="jelly:beanshell">
<set var="testStr" value="hello"/>
<log:info>${testStr.charAt(-2)}</log:info>
</jelly>
Throws the exception below. Changing the number to positive fixes the error. I realize this would cause an OOB but it is just to demonstrate that something seems to be wrong with the parsing of the expression.
org.apache.commons.jexl.parser.ParseException: Encountered "( -" at line 1, column 15.
Was expecting one of:
"||" ...
"or" ...
"&&" ...
"and" ...
"|" ...
"^" ...
"&" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"<" ...
"lt" ...
">" ...
"gt" ...
"<=" ...
"le" ...
">=" ...
"ge" ...
"+" ...
"-" ...
"*" ...
"/" ...
"div" ...
"%" ...
"mod" ...
";" ...
"[" ...
"(" <INTEGER_LITERAL> ...
"(" <FLOAT_LITERAL> ...
"(" "true" ...
"(" "false" ...
"(" <STRING_LITERAL> ...
"(" "null" ...
"(" <IDENTIFIER> ...
"(" "(" ...
"(" "empty" ...
"(" "size" ...
"(" "~" ...
"(" "!" ...
"(" "not" ...
"(" ")" ...
"." ...
"=" ...
at org.apache.commons.jexl.parser.Parser.generateParseException(Parser.java:3193)
at org.apache.commons.jexl.parser.Parser.jj_consume_token(Parser.java:3077)
at org.apache.commons.jexl.parser.Parser.ExpressionExpression(Parser.java:1519)
at org.apache.commons.jexl.parser.Parser.Statement(Parser.java:1492)
at org.apache.commons.jexl.parser.Parser.JexlScript(Parser.java:58)
at org.apache.commons.jexl.parser.Parser.parse(Parser.java:18)
at org.apache.commons.jexl.ExpressionFactory.createNewExpression(ExpressionFactory.java:124)
at org.apache.commons.jexl.ExpressionFactory.createExpression(ExpressionFactory.java:88)
at org.apache.commons.jelly.expression.jexl.JexlExpressionFactory.createExpression(JexlExpressionFactory.java:102)
at org.apache.commons.jelly.expression.CompositeExpression.parse(CompositeExpression.java:128)
at org.apache.commons.jelly.parser.XMLParser.addTextScript(XMLParser.java:1069)
at org.apache.commons.jelly.parser.XMLParser.endElement(XMLParser.java:681)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:579)
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:897)
at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:643)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1972)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:878)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1144)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:987)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1445)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
at org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:296)
at org.apache.commons.jelly.Jelly.compileScript(Jelly.java:165)
at org.apache.commons.jelly.Jelly.main(Jelly.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.werken.forehead.Forehead.run(Forehead.java:543)
at com.werken.forehead.Forehead.main(Forehead.java:573)
[ERROR] XMLParser - -Caught exception: org.apache.commons.jexl.parser.ParseException: Encountered "( -" at line 1, column 15.
Was expecting one of:
"||" ...
"or" ...
"&&" ...
"and" ...
"|" ...
"^" ...
"&" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"<" ...
"lt" ...
">" ...
"gt" ...
"<=" ...
"le" ...
">=" ...
"ge" ...
"+" ...
"-" ...
"*" ...
"/" ...
"div" ...
"%" ...
"mod" ...
";" ...
"[" ...
"(" <INTEGER_LITERAL> ...
"(" <FLOAT_LITERAL> ...
"(" "true" ...
"(" "false" ...
"(" <STRING_LITERAL> ...
"(" "null" ...
"(" <IDENTIFIER> ...
"(" "(" ...
"(" "empty" ...
"(" "size" ...
"(" "~" ...
"(" "!" ...
"(" "not" ...
"(" ")" ...
"." ...
"=" ...
<org.apache.commons.jexl.parser.ParseException: Encountered "( -" at line 1, column 15.
Was expecting one of:
"||" ...
"or" ...
"&&" ...
"and" ...
"|" ...
"^" ...
"&" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"<" ...
"lt" ...
">" ...
"gt" ...
"<=" ...
"le" ...
">=" ...
"ge" ...
"+" ...
"-" ...
"*" ...
"/" ...
"div" ...
"%" ...
"mod" ...
";" ...
"[" ...
"(" <INTEGER_LITERAL> ...
"(" <FLOAT_LITERAL> ...
"(" "true" ...
"(" "false" ...
"(" <STRING_LITERAL> ...
"(" "null" ...
"(" <IDENTIFIER> ...
"(" "(" ...
"(" "empty" ...
"(" "size" ...
"(" "~" ...
"(" "!" ...
"(" "not" ...
"(" ")" ...
"." ...
"=" ...
>
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.werken.forehead.Forehead.run(Forehead.java:543)
at com.werken.forehead.Forehead.main(Forehead.java:573)
Caused by: org.apache.commons.jexl.parser.ParseException: Encountered "( -" at line 1, column 15.
Was expecting one of:
"||" ...
"or" ...
"&&" ...
"and" ...
"|" ...
"^" ...
"&" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"<" ...
"lt" ...
">" ...
"gt" ...
"<=" ...
"le" ...
">=" ...
"ge" ...
"+" ...
"-" ...
"*" ...
"/" ...
"div" ...
"%" ...
"mod" ...
";" ...
"[" ...
"(" <INTEGER_LITERAL> ...
"(" <FLOAT_LITERAL> ...
"(" "true" ...
"(" "false" ...
"(" <STRING_LITERAL> ...
"(" "null" ...
"(" <IDENTIFIER> ...
"(" "(" ...
"(" "empty" ...
"(" "size" ...
"(" "~" ...
"(" "!" ...
"(" "not" ...
"(" ")" ...
"." ...
"=" ...
at org.apache.commons.jelly.parser.XMLParser.endElement(XMLParser.java:705)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:579)
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:897)
at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:643)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1972)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:878)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1144)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:987)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1445)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
at org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:296)
at org.apache.commons.jelly.Jelly.compileScript(Jelly.java:165)
at org.apache.commons.jelly.Jelly.main(Jelly.java:122)
... 6 more