SaslException (Java Platform SE 8 ) (original) (raw)
- java.lang.Throwable
- java.lang.Exception
- java.io.IOException
* * javax.security.sasl.SaslException
- java.io.IOException
- java.lang.Exception
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AuthenticationException
public class SaslException
extends IOException
This class represents an error that has occurred when using SASL.
Since:
1.5
See Also:
Serialized Form
Constructor Summary
Constructors
Constructor Description SaslException() Constructs a new instance of SaslException. SaslException(String detail) Constructs a new instance of SaslException with a detailed message. SaslException(String detail,Throwable ex) Constructs a new instance of SaslException with a detailed message and a root exception. Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method Description Throwable getCause() Returns the cause of this throwable or null if the cause is nonexistent or unknown. Throwable initCause(Throwable cause) Initializes the cause of this throwable to the specified value. String toString() Returns the string representation of this exception. * ### Methods inherited from class java.lang.[Throwable](../../../java/lang/Throwable.html "class in java.lang") `[addSuppressed](../../../java/lang/Throwable.html#addSuppressed-java.lang.Throwable-), [fillInStackTrace](../../../java/lang/Throwable.html#fillInStackTrace--), [getLocalizedMessage](../../../java/lang/Throwable.html#getLocalizedMessage--), [getMessage](../../../java/lang/Throwable.html#getMessage--), [getStackTrace](../../../java/lang/Throwable.html#getStackTrace--), [getSuppressed](../../../java/lang/Throwable.html#getSuppressed--), [printStackTrace](../../../java/lang/Throwable.html#printStackTrace--), [printStackTrace](../../../java/lang/Throwable.html#printStackTrace-java.io.PrintStream-), [printStackTrace](../../../java/lang/Throwable.html#printStackTrace-java.io.PrintWriter-), [setStackTrace](../../../java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement:A-)` * ### Methods inherited from class java.lang.[Object](../../../java/lang/Object.html "class in java.lang") `[clone](../../../java/lang/Object.html#clone--), [equals](../../../java/lang/Object.html#equals-java.lang.Object-), [finalize](../../../java/lang/Object.html#finalize--), [getClass](../../../java/lang/Object.html#getClass--), [hashCode](../../../java/lang/Object.html#hashCode--), [notify](../../../java/lang/Object.html#notify--), [notifyAll](../../../java/lang/Object.html#notifyAll--), [wait](../../../java/lang/Object.html#wait--), [wait](../../../java/lang/Object.html#wait-long-), [wait](../../../java/lang/Object.html#wait-long-int-)`
Constructor Detail
* #### SaslException public SaslException() Constructs a new instance of `SaslException`. The root exception and the detailed message are null. * #### SaslException public SaslException([String](../../../java/lang/String.html "class in java.lang") detail) Constructs a new instance of `SaslException` with a detailed message. The root exception is null. Parameters: `detail` \- A possibly null string containing details of the exception. See Also: [Throwable.getMessage()](../../../java/lang/Throwable.html#getMessage--) * #### SaslException public SaslException([String](../../../java/lang/String.html "class in java.lang") detail, [Throwable](../../../java/lang/Throwable.html "class in java.lang") ex) Constructs a new instance of `SaslException` with a detailed message and a root exception. For example, a SaslException might result from a problem with the callback handler, which might throw a NoSuchCallbackException if it does not support the requested callback, or throw an IOException if it had problems obtaining data for the callback. The SaslException's root exception would be then be the exception thrown by the callback handler. Parameters: `detail` \- A possibly null string containing details of the exception. `ex` \- A possibly null root exception that caused this exception. See Also: [Throwable.getMessage()](../../../java/lang/Throwable.html#getMessage--), [getCause()](../../../javax/security/sasl/SaslException.html#getCause--)
Method Detail
* #### getCause public [Throwable](../../../java/lang/Throwable.html "class in java.lang") getCause() Description copied from class: `[Throwable](../../../java/lang/Throwable.html#getCause--)` Returns the cause of this throwable or `null` if the cause is nonexistent or unknown. (The cause is the throwable that caused this throwable to get thrown.) This implementation returns the cause that was supplied via one of the constructors requiring a `Throwable`, or that was set after creation with the [Throwable.initCause(Throwable)](../../../java/lang/Throwable.html#initCause-java.lang.Throwable-) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means. This is appropriate for a "legacy chained throwable" that predates the addition of chained exceptions to `Throwable`. Note that it is _not_ necessary to override any of the `PrintStackTrace` methods, all of which invoke the `getCause` method to determine the cause of a throwable. Overrides: `[getCause](../../../java/lang/Throwable.html#getCause--)` in class `[Throwable](../../../java/lang/Throwable.html "class in java.lang")` Returns: the cause of this throwable or `null` if the cause is nonexistent or unknown. * #### initCause public [Throwable](../../../java/lang/Throwable.html "class in java.lang") initCause([Throwable](../../../java/lang/Throwable.html "class in java.lang") cause) Description copied from class: `[Throwable](../../../java/lang/Throwable.html#initCause-java.lang.Throwable-)` Initializes the _cause_ of this throwable to the specified value. (The cause is the throwable that caused this throwable to get thrown.) This method can be called at most once. It is generally called from within the constructor, or immediately after creating the throwable. If this throwable was created with [Throwable.Throwable(Throwable)](../../../java/lang/Throwable.html#Throwable-java.lang.Throwable-) or[Throwable.Throwable(String,Throwable)](../../../java/lang/Throwable.html#Throwable-java.lang.String-java.lang.Throwable-), this method cannot be called even once. An example of using this method on a legacy throwable type without other support for setting the cause is: try { lowLevelOp(); } catch (LowLevelException le) { throw (HighLevelException) new HighLevelException().initCause(le); // Legacy constructor } Overrides: `[initCause](../../../java/lang/Throwable.html#initCause-java.lang.Throwable-)` in class `[Throwable](../../../java/lang/Throwable.html "class in java.lang")` Parameters: `cause` \- the cause (which is saved for later retrieval by the[Throwable.getCause()](../../../java/lang/Throwable.html#getCause--) method). (A `null` value is permitted, and indicates that the cause is nonexistent or unknown.) Returns: a reference to this `Throwable` instance. * #### toString public [String](../../../java/lang/String.html "class in java.lang") toString() Returns the string representation of this exception. The string representation contains this exception's class name, its detailed message, and if it has a root exception, the string representation of the root exception. This string representation is meant for debugging and not meant to be interpreted programmatically. Overrides: `[toString](../../../java/lang/Throwable.html#toString--)` in class `[Throwable](../../../java/lang/Throwable.html "class in java.lang")` Returns: The non-null string representation of this exception. See Also: [Throwable.getMessage()](../../../java/lang/Throwable.html#getMessage--)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.