I upgraded to 3.0.2.RELEASE from 3.0.1.RELEASE and suddenly my test which was passing is suddenly failing. Here is the test:
Code:public class SpELUtilsTest { @Test public void testGetValue(){ Map props1= new HashMap<String,String>(); props1.put("key1", "value1"); props1.put("key2", "value2"); props1.put("key3", "value3"); Object bean = new TestBean("name1",new TestBean("name2",null,"Description 2",15,props1),"description 1", 6,props1); ExpressionParser parser = new SpelExpressionParser(); Expression exp = parser.parseExpression("testBean.properties['key2']"); String key= (String)exp.getValue(bean); } public static class TestBean { private String name; private TestBean testBean; private String description; private Integer priority; private Map properties; public TestBean() { super(); } public TestBean(String name, TestBean testBean, String description,Integer priority,Map props) { super(); this.name = name; this.testBean = testBean; this.description = description; this.priority=priority; this.properties=props; } public String getName() { return name; } public void setName(String name) { this.name = name; } public TestBean getTestBean() { return testBean; } public void setTestBean(TestBean testBean) { this.testBean = testBean; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Integer getPriority() { return priority; } public void setPriority(Integer priority) { this.priority = priority; } public Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } } }
I am getting an ArrayOutOfBoundsException on the getValue() method.
Here is the stacktrace:
Should I file a bug report???Code:java.lang.ArrayIndexOutOfBoundsException: -1 at org.springframework.core.MethodParameter.getParameterType(MethodParameter.java:154) at org.springframework.core.convert.TypeDescriptor.getType(TypeDescriptor.java:190) at org.springframework.core.convert.TypeDescriptor.isTypeAssignableTo(TypeDescriptor.java:525) at org.springframework.core.convert.TypeDescriptor.isMap(TypeDescriptor.java:283) at org.springframework.expression.spel.ast.Indexer.getValueInternal(Indexer.java:92) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:57) at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:71) at net.youngdev.springutils.expression.SpELUtilsTest.testGetValue(SpELUtilsTest.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) 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)


Reply With Quote