java.lang.IllegalArgumentException

GitHub | kaybinwong | 7 months ago
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  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

    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.create
      1. net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
      2. net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
      2 frames
    6. com.wintv.cache
      ProxyTest.main
      1. com.wintv.cache.AbstractProxy.getInstance(AbstractProxy.java:49)
      2. com.wintv.cache.test.ProxyTest.testSimple(ProxyTest.java:31)
      3. com.wintv.cache.test.ProxyTest.main(ProxyTest.java:38)
      3 frames
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    8. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
      1 frame