I’ve found that under certain cases my code’s checked Exceptions will fail to bubble up to the caller when I enable Jrebel’s Java agent on my Tomcat server.
I know that the corner case affected involves some combination Groovy and Java 8 Interfaces with default implementations. I finally found a stack trace for the Exception that I expected to see thrown in my application inside my jrebel.log:
2017-02-01 13:37:10.021 INFO [18] [Core] We got an exception when calling the taget: There is something wrong with the input you have provided: com.guild.form.exception.InvalidFormException: There is something wrong with the input you have provided
at com.guild.form.Validator.checkValidation(Validator.java:23)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at com.zeroturnaround.javarebel.mB.__jr_selector__(JRebel:93)
...
When I decompiled the jrebel jar and looked at that Class, I found what I believe to be the problem:
public Object __jr_selector__(int var1, Object var2, Object[] var3) {
try {
MethodHandle var4 = this.a.bindTo(var2);
return var4.invokeWithArguments(var3);
} catch (RuntimeException var5) {
throw var5;
} catch (Throwable var6) {
fj.getInstance("Core").info("We got an exception when calling the taget: " + var6.getMessage(), var6);
return new RuntimeException(var6);
}
}
It seems to me that when you wrap my checked Exception with your RuntimeException, you should throw it back up instead of returning it.