java.lang.reflect.UndeclaredThrowableException

Atlassian JIRA | Kasper Nielsen | 3 years ago
  1. 0

    I have the following test stub (src/main/java) {code:java} public final class TestStub { TestStub() { throw new IllegalArgumentException(); } public static void getHandler() { new HashMap<>().computeIfAbsent(String.class, t -> new TestStub()); } } {code} And the following test (src/test/java) {code:java} public class FooTest { @Test(expected = IllegalArgumentException.class) public void test0() { TestStub.getHandler(); } } {code} Using maven It runs fine using "clean install" however using clover I get the following exception {noformat} java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy12.apply(Unknown Source) at java.util.HashMap.computeIfAbsent(HashMap.java:1118) at org.cakeframework.internal.container.TestStub.getHandler(TestStub.java:26) at org.cakeframework.internal.container.FooTest.test0(FooTest.java:29) 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: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.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19) 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.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.reflect.InvocationTargetException 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.cakeframework.internal.container.TestStub$__CLR3_2_0wqwqhpd53be5$1.invoke(TestStub.java:20) ... 28 more Caused by: java.lang.IllegalArgumentException at org.cakeframework.internal.container.TestStub.<init>(TestStub.java:22) at org.cakeframework.internal.container.TestStub.lambda$getHandler$6(TestStub.java:26) at org.cakeframework.internal.container.TestStub$$Lambda$13/1227074340.apply(Unknown Source) ... 33 more {noformat} If I replace with a standard anonymous class implementing java.util.function.Function it runs fine

    Atlassian JIRA | 3 years ago | Kasper Nielsen
    java.lang.reflect.UndeclaredThrowableException
  2. 0

    I have the following test stub (src/main/java) {code:java} public final class TestStub { TestStub() { throw new IllegalArgumentException(); } public static void getHandler() { new HashMap<>().computeIfAbsent(String.class, t -> new TestStub()); } } {code} And the following test (src/test/java) {code:java} public class FooTest { @Test(expected = IllegalArgumentException.class) public void test0() { TestStub.getHandler(); } } {code} Using maven It runs fine using "clean install" however using clover I get the following exception {noformat} java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy12.apply(Unknown Source) at java.util.HashMap.computeIfAbsent(HashMap.java:1118) at org.cakeframework.internal.container.TestStub.getHandler(TestStub.java:26) at org.cakeframework.internal.container.FooTest.test0(FooTest.java:29) 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: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.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19) 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.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.reflect.InvocationTargetException 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.cakeframework.internal.container.TestStub$__CLR3_2_0wqwqhpd53be5$1.invoke(TestStub.java:20) ... 28 more Caused by: java.lang.IllegalArgumentException at org.cakeframework.internal.container.TestStub.<init>(TestStub.java:22) at org.cakeframework.internal.container.TestStub.lambda$getHandler$6(TestStub.java:26) at org.cakeframework.internal.container.TestStub$$Lambda$13/1227074340.apply(Unknown Source) ... 33 more {noformat} If I replace with a standard anonymous class implementing java.util.function.Function it runs fine

    Atlassian JIRA | 3 years ago | Kasper Nielsen
    java.lang.reflect.UndeclaredThrowableException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    IronGolem crash

    GitHub | 5 months ago | InventivetalentDev
    java.lang.RuntimeException: Failed to invoke @Watch method void damageArmor(float) with args: [3.0, SuperSwitch(state=PASS)]
  5. 0

    FinancingMonthlyPayment no return currencyID

    GitHub | 2 months ago | felipegirotti
    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 org.cakeframework.internal.container.TestStub.<init>()
    2. org.cakeframework.internal
      TestStub.lambda$getHandler$6
      1. org.cakeframework.internal.container.TestStub.<init>(TestStub.java:22)
      2. org.cakeframework.internal.container.TestStub.lambda$getHandler$6(TestStub.java:26)
      2 frames