Udostępnij za pośrednictwem


Throwable.SetStackTrace(StackTraceElement[]) Method

Definition

Sets the stack trace elements that will be returned by #getStackTrace() and printed by #printStackTrace() and related methods.

[Android.Runtime.Register("setStackTrace", "([Ljava/lang/StackTraceElement;)V", "GetSetStackTrace_arrayLjava_lang_StackTraceElement_Handler")]
public virtual void SetStackTrace (Java.Lang.StackTraceElement[] stackTrace);
[<Android.Runtime.Register("setStackTrace", "([Ljava/lang/StackTraceElement;)V", "GetSetStackTrace_arrayLjava_lang_StackTraceElement_Handler")>]
abstract member SetStackTrace : Java.Lang.StackTraceElement[] -> unit
override this.SetStackTrace : Java.Lang.StackTraceElement[] -> unit

Parameters

stackTrace
StackTraceElement[]

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.

Attributes

Exceptions

if any element in trace is null.

Remarks

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 ThrowableThrowable#Throwable(String, Throwable, boolean, boolean) is not writable, calling this method has no effect other than validating its argument.

Added in 1.4.

Java documentation for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also