java.lang.NullPointerException

Hibernate JIRA | Hamid Nazari | 1 year ago
  1. 0

    Today I switched from HV 5.0.1 to 5.2.1 and happily enough to know that it was claimed to be a drop-in replacement for all 5.x versions, I started my code and WOW! My code throws NPE at our initial system validations with this stack trace: {code:java} java.lang.NullPointerException at org.hibernate.validator.internal.engine.ValueContext.appendNode(ValueContext.java:131) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:539) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406) at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:770) at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:656) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:415) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204) {code} Working a little bit on the issue, I could manage to reproduce it in a simple unit test that I've attached. I repeat it here for the sake of description. Suppose that we have these simple classes: {code:java} public class MainBean { @Valid public TopBean child; } public class TopBean { @NotNull private String getProperty() { return null; } } public class BottomBean extends TopBean { } {code} If I want to validate an instance of {{MainBean}} which has an instance of {{BottomBean}} as its child, the mentioned exception occurs! I searched the issue database to find that HV-975 has already reported this same issue, but since there has been no test cases, the issue was resolved with "Cannot Reproduce". As I could not reopen the issue, I decided to report it here since I think it is a downside to a very reliable library.

    Hibernate JIRA | 1 year ago | Hamid Nazari
    java.lang.NullPointerException
  2. 0

    Today I switched from HV 5.0.1 to 5.2.1 and happily enough to know that it was claimed to be a drop-in replacement for all 5.x versions, I started my code and WOW! My code throws NPE at our initial system validations with this stack trace: {code:java} java.lang.NullPointerException at org.hibernate.validator.internal.engine.ValueContext.appendNode(ValueContext.java:131) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:539) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406) at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:770) at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:656) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:415) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204) {code} Working a little bit on the issue, I could manage to reproduce it in a simple unit test that I've attached. I repeat it here for the sake of description. Suppose that we have these simple classes: {code:java} public class MainBean { @Valid public TopBean child; } public class TopBean { @NotNull private String getProperty() { return null; } } public class BottomBean extends TopBean { } {code} If I want to validate an instance of {{MainBean}} which has an instance of {{BottomBean}} as its child, the mentioned exception occurs! I searched the issue database to find that HV-975 has already reported this same issue, but since there has been no test cases, the issue was resolved with "Cannot Reproduce". As I could not reopen the issue, I decided to report it here since I think it is a downside to a very reliable library.

    Hibernate JIRA | 1 year ago | Hamid Nazari
    java.lang.NullPointerException
  3. 0

    I have a small project in which I switched from standard values to {{java.util.Optional}}. Now any validation results in {{NullPointerExceptions}} in {{ValueContext.appendNode}}. When redesigning the objects, I changed them from interfaces to abstract classes, but that should not inhibit validation. All fields are wrapped in {{Optional}} before returning, but are stored directly. Both field and method annotations lead to {{NullPointerExceptions}}. In fact, when changing one of the getters to return the field directly, with {{Optional}} wrapping, it still leads to {{NullPointerException}}. I will try to track it down further. But I can't think of anything else I modified that could explain this. {noformat} java.lang.NullPointerException at org.hibernate.validator.internal.engine.ValueContext.appendNode(ValueContext.java:131) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:527) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:479) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:443) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:395) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:194) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:207) at de.auel.zick.projektverwaltung.client.LocalProjectService.saveProject(LocalProjectService.java:158) at de.auel.zick.projektverwaltung.client.ProjectServiceTest.testSaveProject(ProjectServiceTest.java:120) 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:483) 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.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) 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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) 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:483) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)}} {noformat}

    Hibernate JIRA | 2 years ago | Johannes Zick
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I have a small project in which I switched from standard values to {{java.util.Optional}}. Now any validation results in {{NullPointerExceptions}} in {{ValueContext.appendNode}}. When redesigning the objects, I changed them from interfaces to abstract classes, but that should not inhibit validation. All fields are wrapped in {{Optional}} before returning, but are stored directly. Both field and method annotations lead to {{NullPointerExceptions}}. In fact, when changing one of the getters to return the field directly, with {{Optional}} wrapping, it still leads to {{NullPointerException}}. I will try to track it down further. But I can't think of anything else I modified that could explain this. {noformat} java.lang.NullPointerException at org.hibernate.validator.internal.engine.ValueContext.appendNode(ValueContext.java:131) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:527) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:479) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:443) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:395) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:194) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:207) at de.auel.zick.projektverwaltung.client.LocalProjectService.saveProject(LocalProjectService.java:158) at de.auel.zick.projektverwaltung.client.ProjectServiceTest.testSaveProject(ProjectServiceTest.java:120) 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:483) 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.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) 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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) 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:483) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)}} {noformat}

    Hibernate JIRA | 2 years ago | Johannes Zick
    java.lang.NullPointerException
  6. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.validator.internal.engine.ValueContext.appendNode()
    2. Hibernate Validator Engine
      ValidatorImpl.validate
      1. org.hibernate.validator.internal.engine.ValueContext.appendNode(ValueContext.java:131)
      2. org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:539)
      3. org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490)
      4. org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454)
      5. org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406)
      6. org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:770)
      7. org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:656)
      8. org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:415)
      9. org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204)
      9 frames