[ http://issues.apache.org/jira/browse/TUSCANY-18?page=all ] Kevin Williams closed TUSCANY-18: ---------------------------------
Verified > NPE when using a QueryString that uses ? for host variables. > ------------------------------------------------------------- > > Key: TUSCANY-18 > URL: http://issues.apache.org/jira/browse/TUSCANY-18 > Project: Tuscany > Type: Bug > Components: Java DAS RDB > Environment: Windows XP Pro, Eclipse 3.2M4 , jdk 1.5, 1/23/2006 tuscany DAS > code stream. (build locally), Derby 10.1 > Reporter: Ying Chen > Assignee: Kevin Williams > Priority: Minor > > This only happens for select queries... Insert, update, delete does not have > the problem. > I have code snippet > Command select = Command.FACTORY.createCommand("Select > * from CUSTOMERS where CUSTOMERID = ? "); > select.setConnection(getConnection); > select.setParameterValue(1, new Integer(2) ); > DataObject root = select.executeQuery(); > When executeQuery() is called, I get an NPE..from > QueryString.getParameterIndex(). > Note that the same query works when its replace text? host variable : > Command select = Command.FACTORY.createCommand("Select > * from CUSTOMERS where CUSTOMERID = :CUST "); > select.setConnection(getConnection); > select.setParameterValue("CUST", new Integer(2) ); > DataObject root = select.executeQuery(); > The trace stack is as follows: > java.lang.NullPointerException > at > org.apache.tuscany.das.rdb.impl.QueryString.getParameterIndex(QueryString.java:50) > at > org.apache.tuscany.das.rdb.impl.Statement.setParameters(Statement.java:154) > at > org.apache.tuscany.das.rdb.impl.Statement.executeQuery(Statement.java:47) > at > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl.java:87) > at > com.ibm.etools.sdo.das.tests.suites.SelectTest.testSelect(SelectTest.java:50) > 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:585) > 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 junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
