Closed aley2003 closed 2 years ago
Stack trace:
09:12:49,463 (main) ERROR [DataNucleus.General] - >> Exception in test javax.jdo.JDOUserException: Exception thrown while loading remaining rows of query at org.datanucleus.api.jdo.JDOAdapter.getUserExceptionForException(JDOAdapter.java:507) ~[datanucleus-api-jdo-6.0.1.jar:?] at org.datanucleus.store.rdbms.query.ForwardQueryResult.closingConnection(ForwardQueryResult.java:304) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.query.AbstractQueryResult.disconnect(AbstractQueryResult.java:106) ~[datanucleus-core-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.AbstractRDBMSQueryResult.disconnect(AbstractRDBMSQueryResult.java:283) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.JDOQLQuery$1.transactionPreClose(JDOQLQuery.java:739) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.connection.AbstractManagedConnection.transactionPreClose(AbstractManagedConnection.java:117) ~[datanucleus-core-6.0.2.jar:?] at org.datanucleus.store.connection.ConnectionManagerImpl$2.transactionPreCommit(ConnectionManagerImpl.java:514) ~[datanucleus-core-6.0.2.jar:?] at org.datanucleus.transaction.TransactionImpl.internalPreCommit(TransactionImpl.java:398) ~[datanucleus-core-6.0.2.jar:?] at org.datanucleus.transaction.TransactionImpl.commit(TransactionImpl.java:288) ~[datanucleus-core-6.0.2.jar:?] at org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:94) ~[datanucleus-api-jdo-6.0.1.jar:?] at org.datanucleus.test.SimpleTest.testSimple(SimpleTest.java:43) [test-classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) [junit-4.13.1.jar:4.13.1] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.13.1.jar:4.13.1] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) [junit-4.13.1.jar:4.13.1] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.1.jar:4.13.1] at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) [junit-4.13.1.jar:4.13.1] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) [junit-4.13.1.jar:4.13.1] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.1.jar:4.13.1] at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.20.jar:2.20] at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) [surefire-junit4-2.20.jar:2.20] at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) [surefire-junit4-2.20.jar:2.20] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.20.jar:2.20] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386) [surefire-booter-2.20.jar:2.20] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323) [surefire-booter-2.20.jar:2.20] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143) [surefire-booter-2.20.jar:2.20] Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "value" is null at org.datanucleus.store.rdbms.query.ResultClassROF$ResultClassFieldSetter.set(ResultClassROF.java:888) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.ResultClassROF.getObject(ResultClassROF.java:337) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.ForwardQueryResult.nextResultSetElement(ForwardQueryResult.java:181) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.ForwardQueryResult$QueryResultIterator.next(ForwardQueryResult.java:410) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.ForwardQueryResult.processNumberOfResults(ForwardQueryResult.java:137) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.ForwardQueryResult.advanceToEndOfResultSet(ForwardQueryResult.java:165) ~[datanucleus-rdbms-6.0.2.jar:?] at org.datanucleus.store.rdbms.query.ForwardQueryResult.closingConnection(ForwardQueryResult.java:292) ~[datanucleus-rdbms-6.0.2.jar:?] ... 36 more
You didnt provide a PR in an earlier issue, so provide a PR. Your issue
The problem can be resolved by replacing ResultClassROF:888
if (field.getType().isAssignableFrom(value.getClass()))
with
if (value == null || field.getType().isAssignableFrom(value.getClass()))
Presumably fixed
Was this issue also present in the 5.2 branch or exclusive to 6.x?
This was a bug in 6.x only
Feature Request: provide as much detail as possible about behaviour. Define a testcase that shows what handling is expected.
Bug Report, attach a testcase using problem guide and state what version the problem occurs in. THIS IS MANDATORY. Any "Bug" without a testcase will be CLOSED.
ResultClassROF.getObject() raises a NullPointerException if a database value of null has to be mapped to a result object. See attached test case.
Please NOTE that people are strongly encouraged to CONTRIBUTE features / fixes, since this is open source software. test-jdo-ResultClassROF-NPE.zip