Juozas Baliuks created JEXL-142:
-----------------------------------
Summary: Map expression issue with empty key
Key: JEXL-142
URL: https://issues.apache.org/jira/browse/JEXL-142
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 2.1.1
Reporter: Juozas Baliuks
Fix For: 2.1.2
Map expressions fail if key is an empty string: map['']
Attachement contains patch with a fix and test case.
java.lang.StringIndexOutOfBoundsException: String index out of range: 3
at java.lang.AbstractStringBuilder.charAt(Unknown Source)
at java.lang.StringBuilder.charAt(Unknown Source)
at
org.apache.commons.jexl2.internal.PropertyGetExecutor.discoverGet(PropertyGetExecutor.java:103)
at
org.apache.commons.jexl2.internal.PropertyGetExecutor.discover(PropertyGetExecutor.java:82)
at
org.apache.commons.jexl2.internal.PropertyGetExecutor.<init>(PropertyGetExecutor.java:38)
at
org.apache.commons.jexl2.internal.Introspector.getGetExecutor(Introspector.java:230)
at
org.apache.commons.jexl2.introspection.UberspectImpl.getPropertyGet(UberspectImpl.java:136)
at
org.apache.commons.jexl2.Interpreter.getAttribute(Interpreter.java:1537)
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:482)
at
org.apache.commons.jexl2.parser.ASTArrayAccess.jjtAccept(ASTArrayAccess.java:18)
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1317)
at
org.apache.commons.jexl2.parser.ASTReference.jjtAccept(ASTReference.java:18)
at org.apache.commons.jexl2.Interpreter.interpret(Interpreter.java:232)
at
org.apache.commons.jexl2.ExpressionImpl.evaluate(ExpressionImpl.java:65)
at
org.apache.commons.jexl2.MapLiteralTest.testLiteralWithNumbers(MapLiteralTest.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira