java.lang.NullPointerException

Spring JIRA | Andy Wilkinson | 8 years ago
  1. 0

    I'm trying to get the dm Server 2.0 codebase working against Spring 3.0.0.M2 and have hit a problem in StaticLabeledEnumResolver. There would appear to be a regression from 2.5.6.A. The problem's probably best illustrated by the attached. Assuming that you have the attached class and jar in the current directory, along with spring core's jar and commons logging, the following should reproduce the problem: java -classpath .:com.springsource.org.apache.commons.logging-1.1.1.jar:org.springframework.core-3.0.0.M2.jar StaticLabeledEnumResolverTest Exception in thread "main" java.lang.NullPointerException at org.springframework.core.enums.AbstractCachingLabeledEnumResolver.getLabeledEnumByLabel(AbstractCachingLabeledEnumResolver.java:75) at StaticLabeledEnumResolverTest.main(StaticLabeledEnumResolverTest.java:17) Having looked at what's happening in the debugger it would appear that the first call to CachingMapDecorator.get() adds a weakly-referenced value to the map, keyed by the enum class. With nothing else referencing the value, garbage collection leaves the WeakReference pointing to null. This then causes the NPE. It's key that FooEnum.jar isn't on the claspath. If FooEnum.jar is on the classpath the NPE does not occur as the weakly-referenced value is still strongly-referenced from elsewhere. This is currently blocking a fairly major please of work that we had hoped to complete in our current sprint: I'd really appreciate it if you could take a look at this ASAP.

    Spring JIRA | 8 years ago | Andy Wilkinson
    java.lang.NullPointerException
  2. 0

    I'm trying to get the dm Server 2.0 codebase working against Spring 3.0.0.M2 and have hit a problem in StaticLabeledEnumResolver. There would appear to be a regression from 2.5.6.A. The problem's probably best illustrated by the attached. Assuming that you have the attached class and jar in the current directory, along with spring core's jar and commons logging, the following should reproduce the problem: java -classpath .:com.springsource.org.apache.commons.logging-1.1.1.jar:org.springframework.core-3.0.0.M2.jar StaticLabeledEnumResolverTest Exception in thread "main" java.lang.NullPointerException at org.springframework.core.enums.AbstractCachingLabeledEnumResolver.getLabeledEnumByLabel(AbstractCachingLabeledEnumResolver.java:75) at StaticLabeledEnumResolverTest.main(StaticLabeledEnumResolverTest.java:17) Having looked at what's happening in the debugger it would appear that the first call to CachingMapDecorator.get() adds a weakly-referenced value to the map, keyed by the enum class. With nothing else referencing the value, garbage collection leaves the WeakReference pointing to null. This then causes the NPE. It's key that FooEnum.jar isn't on the claspath. If FooEnum.jar is on the classpath the NPE does not occur as the weakly-referenced value is still strongly-referenced from elsewhere. This is currently blocking a fairly major please of work that we had hoped to complete in our current sprint: I'd really appreciate it if you could take a look at this ASAP.

    Spring JIRA | 8 years ago | Andy Wilkinson
    java.lang.NullPointerException
  3. 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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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.springframework.core.enums.AbstractCachingLabeledEnumResolver.getLabeledEnumByLabel()
    2. Spring Core
      AbstractCachingLabeledEnumResolver.getLabeledEnumByLabel
      1. org.springframework.core.enums.AbstractCachingLabeledEnumResolver.getLabeledEnumByLabel(AbstractCachingLabeledEnumResolver.java:75)
      1 frame
    3. Unknown
      StaticLabeledEnumResolverTest.main
      1. StaticLabeledEnumResolverTest.main(StaticLabeledEnumResolverTest.java:17)
      1 frame