Reference:Java.lang.Throwable

From Triled Wiki

Jump to: navigation, search


java.lang
public class java.lang.Throwable

java.lang.Object
java.lang.Throwable Serializable
This class is the superclass of all classes which can be thrown by the virtual machine. The two direct subclasses represent recoverable exceptions (Exception) and unrecoverable errors (Error). This class provides common methods for accessing a string message which provides extra information about the circumstances in which the Throwable was created, and for filling in a stack trace (i.e., a record of the call stack at a particular point in time) which can be printed later.

Contents

[edit] Known Direct Subclasses
Error, Exception
[edit] Known Indirect Subclasses

AbstractMethodError, AccessControlException, AclNotFoundException, ActivityNotFoundException, AlreadyConnectedException, AndroidException, AndroidRuntimeException, AnnotationFormatError, AnnotationTypeMismatchException, ArithmeticException, ArrayIndexOutOfBoundsException, ArrayStoreException, AssertionError, AssertionFailedError, AsynchronousCloseException, BackingStoreException, BadPaddingException, BadParcelableException, BatchUpdateException, BindException, BrokenBarrierException, BufferOverflowException, BufferUnderflowException, CRLException, CancellationException, CancelledKeyException, CertPathBuilderException, CertPathValidatorException, CertStoreException, CertificateEncodingException, CertificateException, CertificateExpiredException, CertificateNotYetValidException, CertificateParsingException, CharConversionException, CharacterCodingException, CircularRedirectException, ClassCastException, ClassCircularityError, ClassFormatError, ClassNotFoundException, CloneNotSupportedException, ClosedByInterruptException, ClosedChannelException, ClosedSelectorException, CoderMalfunctionError, ComparisonFailure, ConcurrentModificationException, ConnectException, ConnectTimeoutException, ConnectionClosedException, ConnectionPendingException, ConnectionPoolTimeoutException, CursorIndexOutOfBoundsException, DOMException, DataFormatException, DataTruncation, DateParseException, DeadObjectException, DestroyFailedException, DigestException, DuplicateFormatFlagsException, EOFException, EmptyStackException, EnumConstantNotPresentException, ExceptionInInitializerError, ExecutionException, ExemptionMechanismException, FactoryConfigurationError, FileLockInterruptionException, FileNotFoundException, FormatFlagsConversionMismatchException, FormatterClosedException, GLException, GeneralSecurityException, GenericSignatureFormatError, HttpHostConnectException, HttpRetryException, IOException, IllegalAccessError, IllegalAccessException, IllegalArgumentException, IllegalBlockSizeException, IllegalBlockingModeException, IllegalCharsetNameException, IllegalClassFormatException, IllegalFormatCodePointException, IllegalFormatConversionException, IllegalFormatException, IllegalFormatFlagsException, IllegalFormatPrecisionException, IllegalFormatWidthException, IllegalMonitorStateException, IllegalSelectorException, IllegalStateException, IllegalThreadStateException, IncompatibleClassChangeError, IncompleteAnnotationException, IndexOutOfBoundsException, InputMismatchException, InstantiationError, InstantiationException, IntentFilter.MalformedMimeTypeException, InternalError, InterruptedException, InterruptedIOException, InvalidAlgorithmParameterException, InvalidClassException, InvalidCredentialsException, InvalidKeyException, InvalidKeySpecException, InvalidMarkException, InvalidMidiDataException, InvalidObjectException, InvalidParameterException, InvalidParameterSpecException, InvalidPreferencesFormatException, InvalidPropertiesFormatException, InvocationTargetException, JSONException, JarException, KeyException, KeyManagementException, KeyStoreException, LastOwnerException, LineUnavailableException, LinkageError, LoginException, MalformedChallengeException, MalformedChunkCodingException, MalformedCookieException, MalformedInputException, MalformedParameterizedTypeException, MalformedURLException, MethodNotSupportedException, MidiUnavailableException, MissingFormatArgumentException, MissingFormatWidthException, MissingResourceException, NegativeArraySizeException, NoClassDefFoundError, NoConnectionPendingException, NoHttpResponseException, NoRouteToHostException, NoSuchAlgorithmException, NoSuchElementException, NoSuchFieldError, NoSuchFieldException, NoSuchMethodError, NoSuchMethodException, NoSuchPaddingException, NoSuchProviderException, NonReadableChannelException, NonWritableChannelException, NotActiveException, NotOwnerException, NotSerializableException, NotYetBoundException, NotYetConnectedException, NullPointerException, NumberFormatException, ObjectStreamException, OpenGLContext.OpenGLContextException, OptionalDataException, OutOfMemoryError, OverlappingFileLockException, PackageManager.NameNotFoundException, ParcelFormatException, ParseException, ParserConfigurationException, PatternSyntaxException, PortUnreachableException, PrivilegedActionException, ProtocolException, ProviderException, ReadOnlyBufferException, ReceiverCallNotAllowedException, RedirectException, RejectedExecutionException, RemoteViews.ActionException, Resources.NotFoundException, RuntimeException, SAXException, SAXNotRecognizedException, SAXNotSupportedException, SAXParseException, SQLException, SQLWarning, SQLiteDatabaseCorruptException, SQLiteDiskIOException, SQLiteException, SSLException, SSLHandshakeException, SSLKeyException, SSLPeerUnverifiedException, SSLProtocolException, SecurityException, Settings.SettingNotFoundException, ShortBufferException, SignatureException, SocketException, SocketTimeoutException, StackOverflowError, StaleDataException, StreamCorruptedException, StringIndexOutOfBoundsException, SyncFailedException, ThreadDeath, TimeFormatException, TimeoutException, TooManyListenersException, TunnelRefusedException, TypeNotPresentException, URISyntaxException, UTFDataFormatException, UndeclaredThrowableException, UnknownError, UnknownFormatConversionException, UnknownFormatFlagsException, UnknownHostException, UnknownServiceException, UnmappableCharacterException, UnmodifiableClassException, UnrecoverableEntryException, UnrecoverableKeyException, UnresolvedAddressException, UnsatisfiedLinkError, UnsupportedAddressTypeException, UnsupportedAudioFileException, UnsupportedCallbackException, UnsupportedCharsetException, UnsupportedClassVersionError, UnsupportedDigestAlgorithmException, UnsupportedEncodingException, UnsupportedHttpVersionException, UnsupportedOperationException, VerifyError, ViewInflate.InflateException, VirtualMachineError, WindowManager.BadTokenException, WriteAbortedException, ZipException

See Also

[edit] Summary

[edit] Public Constructors

          Throwable ()
Constructs a new instance of this class with its stack trace filled in.
          Throwable (String detailMessage)
Constructs a new instance of this class with its stack trace and message filled in.
          Throwable (String detailMessage, Throwable throwable)
Constructs a new instance of this class with its stack trace, message, and cause filled in.
          Throwable (Throwable throwable)
Constructs a new instance of this class with its stack trace and cause filled in.

[edit] Public Methods

        Throwable   fillInStackTrace ()
Records in the receiver a stack trace from the point where this message was sent.
        Throwable   getCause ()
Returns the cause of this Throwable, or null if there is no cause.
        String   getLocalizedMessage ()
Returns the extra information message which was provided when the throwable was created.
        String   getMessage ()
Returns the extra information message which was provided when the throwable was created.
        StackTraceElement[getStackTrace ()
Returns an array of StackTraceElement.
        Throwable   initCause (Throwable throwable)
Initialize the cause of the receiver.
        void  printStackTrace ()
Outputs a printable representation of the receiver's stack trace on the System.err stream.
        void  printStackTrace (PrintWriter err)
Outputs a printable representation of the receiver's stack trace on the PrintWriter specified by the argument.
        void  printStackTrace (PrintStream err)
Outputs a printable representation of the receiver's stack trace on the PrintStream specified by the argument.
        void  setStackTrace (StackTraceElement[ ] trace)
Sets the array of StackTraceElements.
        String   toString ()
Returns a string containing a concise, human-readable description of the receiver.

[edit] Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

[edit] Details

[edit] Public Constructors

[edit] public Throwable()

Constructs a new instance of this class with its stack trace filled in.

[edit] public Throwable(String detailMessage)

Constructs a new instance of this class with its stack trace and message filled in.

Parameters

detailMessage String The detail message for the exception.

[edit] public Throwable(String detailMessage, Throwable throwable)

Constructs a new instance of this class with its stack trace, message, and cause filled in.

Parameters

detailMessage String The detail message for the exception.
throwable The cause of this Throwable

[edit] public Throwable(Throwable throwable)

Constructs a new instance of this class with its stack trace and cause filled in.

Parameters

throwable The cause of this Throwable

[edit] Public Methods

[edit] public Throwable fillInStackTrace()

Records in the receiver a stack trace from the point where this message was sent. The method is public so that code which catches a throwable and then re-throws it can adjust the stack trace to represent the location where the exception was re-thrown.

Returns

  • the receiver

[edit] public Throwable getCause()

Returns the cause of this Throwable, or null if there is no cause.

Returns

  • Throwable The receiver's cause.

[edit] public String getLocalizedMessage()

Returns the extra information message which was provided when the throwable was created. If no message was provided at creation time, then return null. Subclasses may override this method to return localized text for the message.

Returns

  • String The receiver's message.

[edit] public String getMessage()

Returns the extra information message which was provided when the throwable was created. If no message was provided at creation time, then return null.

Returns

  • String The receiver's message.

[edit] public StackTraceElement[ ]getStackTrace()

Returns an array of StackTraceElement. Each StackTraceElement represents a entry on the stack.

Returns

  • an array of StackTraceElement representing the stack

[edit] public Throwable initCause(Throwable throwable)

Initialize the cause of the receiver. The cause cannot be reassigned.

Parameters

throwable The cause of this Throwable

Returns

  • the receiver.

Throws

IllegalArgumentException when the cause is the receiver
IllegalStateException when the cause has already been initialized

[edit] public void printStackTrace()

Outputs a printable representation of the receiver's stack trace on the System.err stream.

[edit] public void printStackTrace(PrintWriter err)

Outputs a printable representation of the receiver's stack trace on the PrintWriter specified by the argument.

Parameters

err PrintWriter The writer to write the stack trace on.

[edit] public void printStackTrace(PrintStream err)

Outputs a printable representation of the receiver's stack trace on the PrintStream specified by the argument.

Parameters

err PrintStream The stream to write the stack trace on.

[edit] public void setStackTrace(StackTraceElement[ ] trace)

Sets the array of StackTraceElements. Each StackTraceElement represents a entry on the stack. A copy of this array will be returned by getStackTrace() and printed by printStackTrace().

Parameters

trace The array of StackTraceElement

[edit] public String toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns

  • String a printable representation for the receiver.

[edit] References

Personal tools