When the ProgrammingException(String) constructor is used, then one would expect that it would still be possible to call initCause(Throwable) on the exception afterwards. However, this is not possible.
I consider this a bug.
There is an easy fix, which is to change the ProgrammingException class to check whether the cause exception is null. If it is not, then no root cause exception is initialized.
A work-around is to use an alternative constructor that accepts a constructor.
Logged In: YES
user_id=11053
Originator: YES
"A work-around is to use an alternative constructor that accepts a
constructor."
should be:
"A work-around is to use an alternative constructor that accepts an exception."