Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Stack trace clobbered when exception thrown by IAnswer impl #34
Migrated from: CodeHaus issue EASYMOCK-23
I've implemented a custom IAnswer handler and set up my mock to return the the result computed by the IAnswer impl. Unfortunately, my IAnswer implementation had a bug in it, resulting in a NullPointerException being thrown. Problem is that it looks like MockInvocationHandler:34 (in v2.4) is replacing the stack trace of my NullPointerException with the stack trace generated at MockInvocationHandler:34. Here's the EasyMock code I'm referring to:
Here's my the stack trace from my test failure:
The reported NPE actually occurred further downstream in my IAnswer implementation. However, the resulting stack trace has erased those frames. I'd like the stack trace to look like this :)
Perhaps I'm misunderstanding how fillInStackTrace() works, but it does appear to replace the existing stack trace. fillInStackTrace() is a native call, so perhaps my JVM (Mac) is screwing things up.
In any case, this clobbering of the stack trace is inconvenient in this scenario, as it looks like EasyMock internals are breaking, when it was really my own code. A debugger helped settle the matter, but it would have been faster to just see my code show up in the original stack trace. Is ther
Here's a similar, but seemingly unrelated bug I came across. It looks like it's a more general case of what I'm experiencing. Thanks for your help on this!