Sets the array of stack trace elements. Each StackTraceElement represents an entry in the call stack. A copy of the specified array is stored in this Throwable. will be returned by getStackTrace() and printed by printStackTrace(). @param trace the new arra
(StackTraceElement[] trace)
| 192 | * @see #printStackTrace() |
| 193 | */ |
| 194 | public void setStackTrace(StackTraceElement[] trace) { |
| 195 | StackTraceElement[] newTrace = trace.clone(); |
| 196 | for (java.lang.StackTraceElement element : newTrace) { |
| 197 | if (element == null) { |
| 198 | throw new NullPointerException(); |
| 199 | } |
| 200 | } |
| 201 | stackTrace = newTrace; |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Writes a printable representation of this {@code Throwable}'s stack trace |