java.lang.IllegalArgumentException

Hibernate JIRA | Mike Curwen | 2 years ago
  1. 0

    I've attached a project that replicates the problem. But the distillation is: When using Java 8, and building your own {{@ValidFoo}} annotation, and using it in a Validator class that implements {{ConstraintValidator<ValidFoo, Foo>}} you get an {{IllegalArgumentException}} from in the depths of cglib/asm. While taking my production codebase and trying to replicate this with a small test case, I always seemed to focus in on the Java8/lambda aspect, because that's where we always found this bug occuring. However, I finally managed to isolate that it's the implementation of the {{ConstraintValidator}} that causes the issue, regardless of whether Java 8 syntax is used in the validator or not. I suspect this is actually a cglib/asm issue that must be solved by them, but I wanted to report it here, just in case. The stacktrace looks like: {noformat} java.lang.IllegalArgumentException at net.sf.cglib.asm.ClassReader.<init>(Unknown Source) at net.sf.cglib.asm.ClassReader.<init>(Unknown Source) at net.sf.cglib.asm.ClassReader.<init>(Unknown Source) at net.sf.cglib.proxy.BridgeMethodResolver.resolveAll(BridgeMethodResolver.java:61) at net.sf.cglib.proxy.Enhancer.emitMethods(Enhancer.java:911) at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:498) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317) at org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:175) at org.easymock.internal.MocksControl.createMock(MocksControl.java:114) at org.easymock.internal.MocksControl.createMock(MocksControl.java:88) at org.easymock.internal.MockBuilder.createMock(MockBuilder.java:206) at org.easymock.internal.MockBuilder.createMock(MockBuilder.java:219) at org.easymock.internal.MockBuilder.createMock(MockBuilder.java:188) at com.company.app.module.constraint.validator.FooValidatorNoJava8Test.createPartialMock(FooValidatorNoJava8Test.java:38) at com.company.app.module.constraint.validator.FooValidatorNoJava8Test.testValid(FooValidatorNoJava8Test.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runners.Suite.runChild(Suite.java:127) at org.junit.runners.Suite.runChild(Suite.java:26) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {noformat}

    Hibernate JIRA | 2 years ago | Mike Curwen
    java.lang.IllegalArgumentException
  2. 0

    I've attached a project that replicates the problem. But the distillation is: When using Java 8, and building your own {{@ValidFoo}} annotation, and using it in a Validator class that implements {{ConstraintValidator<ValidFoo, Foo>}} you get an {{IllegalArgumentException}} from in the depths of cglib/asm. While taking my production codebase and trying to replicate this with a small test case, I always seemed to focus in on the Java8/lambda aspect, because that's where we always found this bug occuring. However, I finally managed to isolate that it's the implementation of the {{ConstraintValidator}} that causes the issue, regardless of whether Java 8 syntax is used in the validator or not. I suspect this is actually a cglib/asm issue that must be solved by them, but I wanted to report it here, just in case. The stacktrace looks like: {noformat} java.lang.IllegalArgumentException at net.sf.cglib.asm.ClassReader.<init>(Unknown Source) at net.sf.cglib.asm.ClassReader.<init>(Unknown Source) at net.sf.cglib.asm.ClassReader.<init>(Unknown Source) at net.sf.cglib.proxy.BridgeMethodResolver.resolveAll(BridgeMethodResolver.java:61) at net.sf.cglib.proxy.Enhancer.emitMethods(Enhancer.java:911) at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:498) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317) at org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:175) at org.easymock.internal.MocksControl.createMock(MocksControl.java:114) at org.easymock.internal.MocksControl.createMock(MocksControl.java:88) at org.easymock.internal.MockBuilder.createMock(MockBuilder.java:206) at org.easymock.internal.MockBuilder.createMock(MockBuilder.java:219) at org.easymock.internal.MockBuilder.createMock(MockBuilder.java:188) at com.company.app.module.constraint.validator.FooValidatorNoJava8Test.createPartialMock(FooValidatorNoJava8Test.java:38) at com.company.app.module.constraint.validator.FooValidatorNoJava8Test.testValid(FooValidatorNoJava8Test.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runners.Suite.runChild(Suite.java:127) at org.junit.runners.Suite.runChild(Suite.java:26) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {noformat}

    Hibernate JIRA | 2 years ago | Mike Curwen
    java.lang.IllegalArgumentException
  3. 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.IllegalArgumentException

      No message provided

      at net.sf.cglib.asm.ClassReader.<init>()
    2. Code Generation Library
      ClassReader.<init>
      1. net.sf.cglib.asm.ClassReader.<init>(Unknown Source)
      2. net.sf.cglib.asm.ClassReader.<init>(Unknown Source)
      3. net.sf.cglib.asm.ClassReader.<init>(Unknown Source)
      3 frames
    3. IDEA
      Enhancer.generateClass
      1. net.sf.cglib.proxy.BridgeMethodResolver.resolveAll(BridgeMethodResolver.java:61)
      2. net.sf.cglib.proxy.Enhancer.emitMethods(Enhancer.java:911)
      3. net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:498)
      3 frames
    4. Code Generation Library
      AbstractClassGenerator.create
      1. net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
      2. net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
      2 frames
    5. IDEA
      Enhancer.createClass
      1. net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
      2. net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
      2 frames
    6. EasyMock
      MockBuilder.createMock
      1. org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:175)
      2. org.easymock.internal.MocksControl.createMock(MocksControl.java:114)
      3. org.easymock.internal.MocksControl.createMock(MocksControl.java:88)
      4. org.easymock.internal.MockBuilder.createMock(MockBuilder.java:206)
      5. org.easymock.internal.MockBuilder.createMock(MockBuilder.java:219)
      6. org.easymock.internal.MockBuilder.createMock(MockBuilder.java:188)
      6 frames
    7. com.company.app
      FooValidatorNoJava8Test.testValid
      1. com.company.app.module.constraint.validator.FooValidatorNoJava8Test.createPartialMock(FooValidatorNoJava8Test.java:38)
      2. com.company.app.module.constraint.validator.FooValidatorNoJava8Test.testValid(FooValidatorNoJava8Test.java:25)
      2 frames
    8. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3 frames
    9. JUnit
      JUnitCore.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      5. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      8. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      9. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      10. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      11. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      12. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      13. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      14. org.junit.runners.Suite.runChild(Suite.java:127)
      15. org.junit.runners.Suite.runChild(Suite.java:26)
      16. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      17. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      18. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      19. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      20. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      21. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      22. org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      22 frames
    10. IntelliJ junit4 module
      JUnit4IdeaTestRunner.startRunnerWithArgs
      1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
      1 frame
    11. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
      2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
      2 frames
    12. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      2 frames
    13. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      1 frame