Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added protection from NPE #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Alexander198961
Copy link

Got Npe during database.insert(user); operation after added protection from npe seems working for me

@ccleve
Copy link
Member

ccleve commented Dec 13, 2017

I'd rather figure out why we got the npe in the first place. Can you help me duplicate the error?

@Alexander198961
Copy link
Author

There is Exception:
com.dieselpoint.norm.DbException: java.lang.NullPointerException
at com.dieselpoint.norm.sqlmakers.StandardSqlMaker.populateGeneratedKey(StandardSqlMaker.java:359)
at com.dieselpoint.norm.Query.execute(Query.java:339)
at com.dieselpoint.norm.Query.insert(Query.java:256)
at com.dieselpoint.norm.Database.insert(Database.java:130)
at com.slice.core.scheduler.SchedulerLinkDelinkTest.testLinkMailboxThenPaidProxys(SchedulerLinkDelinkTest.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at com.slice.core.testkit.ChainStatement$1.run(ChainStatement.java:23)
at com.slice.core.testkit.ChainStatement.evaluate(ChainStatement.java:34)
at com.slice.core.testkit.ChainStatement.evaluate(ChainStatement.java:37)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
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)
Caused by: java.lang.NullPointerException
at com.dieselpoint.norm.sqlmakers.StandardSqlMaker.populateGeneratedKey(StandardSqlMaker.java:334)
... 33 more

so maybe will try to write junit test for this case

@ccleve
Copy link
Member

ccleve commented May 26, 2018

Looks like the line prop.dataType.isAssignable ... is causing the problem. Somehow the dataType isn't getting populated. Please post the code that is failing so we can see the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants