public void setStackTrace (StackTraceElement[] stackTrace)

Sets the stack trace elements that will be returned by getStackTrace() and printed by printStackTrace() and related methods. This method, which is designed for use by RPC frameworks and other advanced systems, allows the client to override the default stack trace that is either generated by fillInStackTrace() when a throwable is constructed or deserialized when a throwable is read from a serialization stream.

If the stack trace of this Throwable is not, calling this method has no effect other than validating its argument.

Parameters:
stackTrace    the stack trace elements to be associated with this Throwable. The specified array is copied by this call; changes in the specified array after the method invocation returns will have no affect on this Throwable's stack trace.

Exceptions:
NullPointerException    if stackTrace is null or if any of the elements of stackTrace are null

Since:  1.4