I have a source like this:
Exception e = new Exception("Exception");
IOException ioE = new IOException("An exception cause");
e.initCause(ioE);
I’m trying to set the cause of the exception “e” and what I get is the exception being set to itself!
I just don’t get it. Does my code make any sense or am I going nuts?
Seems to work:
The output is:
You can see that the cause is set properly.