java.lang.NullPointerException

Spring JIRA | Davide Baroncelli | 1 decade ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    I think I've found a spring 1.2rc1 bug in the method replacement feature. The bug occurs in some cases when using type matching on overloaded methods. The problem lies in the code that creates the cglib proxy when the bean is initialized: this code uses a simple algorithm in order to decide if the method is overloaded: if it has already met it, then it considers the method overloaded. The problem is that upon the first time the method is met, it is always treated as if it was not overloaded, so - even if the first method is not the one that is intended to be treated by the following typed method replacement - at bean creation it is considered as to be replaced (because it is not seen as overloaded, and then the type matching is not done). When executing the method that should not be replaced, nevertheless, the cglib created proxy thinks the method is replaced, passes it to the replacer, but the matching code does reject the method because at this point type matching is performed: no MethodReplacement is returned and a NullPointerException returns. <code> java.lang.NullPointerException at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy$CglibSubclassCreator$ReplaceOverrideMethodInterceptor.intercept(CglibSubclassingInstantiationStrategy.java:168) at it.stratosfera.java.spring.A$$EnhancerByCGLIB$$52d52fd4.a(<generated>) at it.stratosfera.java.spring.TestSpringBug.testSpringBug(TestSpringBug.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86) </code> The attached test case shows the bug.

    Spring JIRA | 1 decade ago | Davide Baroncelli
    java.lang.NullPointerException
  2. 0

    I think I've found a spring 1.2rc1 bug in the method replacement feature. The bug occurs in some cases when using type matching on overloaded methods. The problem lies in the code that creates the cglib proxy when the bean is initialized: this code uses a simple algorithm in order to decide if the method is overloaded: if it has already met it, then it considers the method overloaded. The problem is that upon the first time the method is met, it is always treated as if it was not overloaded, so - even if the first method is not the one that is intended to be treated by the following typed method replacement - at bean creation it is considered as to be replaced (because it is not seen as overloaded, and then the type matching is not done). When executing the method that should not be replaced, nevertheless, the cglib created proxy thinks the method is replaced, passes it to the replacer, but the matching code does reject the method because at this point type matching is performed: no MethodReplacement is returned and a NullPointerException returns. <code> java.lang.NullPointerException at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy$CglibSubclassCreator$ReplaceOverrideMethodInterceptor.intercept(CglibSubclassingInstantiationStrategy.java:168) at it.stratosfera.java.spring.A$$EnhancerByCGLIB$$52d52fd4.a(<generated>) at it.stratosfera.java.spring.TestSpringBug.testSpringBug(TestSpringBug.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86) </code> The attached test case shows the bug.

    Spring JIRA | 1 decade ago | Davide Baroncelli
    java.lang.NullPointerException
  3. 0

    Develottment: Android TDD with Robolectric and JUnit

    develottment.com | 2 years ago
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    UI hang on console hyperlink calculation

    YouTrack | 3 years ago
    java.lang.reflect.InvocationTargetException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy$CglibSubclassCreator$ReplaceOverrideMethodInterceptor.intercept()
    2. Spring Beans
      CglibSubclassingInstantiationStrategy$CglibSubclassCreator$ReplaceOverrideMethodInterceptor.intercept
      1. org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy$CglibSubclassCreator$ReplaceOverrideMethodInterceptor.intercept(CglibSubclassingInstantiationStrategy.java:168)
      1 frame
    3. it.stratosfera.java
      TestSpringBug.testSpringBug
      1. it.stratosfera.java.spring.A$$EnhancerByCGLIB$$52d52fd4.a(<generated>)
      2. it.stratosfera.java.spring.TestSpringBug.testSpringBug(TestSpringBug.java:21)
      2 frames
    4. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    5. com.intellij.rt
      JUnitStarter.main
      1. com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
      1 frame
    6. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    7. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
      1 frame