Unless you explicitly serialize them yourself, I think you can safely assume that creating your temporary transition will not have any bad consequences.
In my opinion, the JVM does not serialize objects without being explicitly requested to do so, so if you do not expect the Exception class to be serialized by your application, I do not think you have a reason for concern.
I assume that if you are writing a library and therefore cannot know all the uses of your class, you might need to be a little more careful.
source share