# TransformerException

public class **TransformerException** extends [Exception](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Exception.html)  

|---|---|---|
| Known Direct Subclasses [TransformerConfigurationException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerConfigurationException.html) |---|---| | [TransformerConfigurationException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerConfigurationException.html) | Indicates a serious configuration error. | |||

This class specifies an exceptional condition that occurred
during the transformation process.

### Public Constructor Summary

|---|---|
|   | [TransformerException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message) Create a new TransformerException. |
|   | [TransformerException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) e) Create a new TransformerException wrapping an existing exception. |
|   | [TransformerException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.String,%20java.lang.Throwable))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) e) Wrap an existing exception in a TransformerException. |
|   | [TransformerException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.String,%20javax.xml.transform.SourceLocator))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) locator) Create a new TransformerException from a message and a Locator. |
|   | [TransformerException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.String,%20javax.xml.transform.SourceLocator,%20java.lang.Throwable))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) locator, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) e) Wrap an existing exception in a TransformerException. |

### Public Method Summary

|---|---|
| [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getCause](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getCause())() Returns the cause of this throwable or `null` if the cause is nonexistent or unknown. |
| [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getException())() This method retrieves an exception that this exception wraps. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLocationAsString](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getLocationAsString())() Get the location information as a string. |
| [SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) | [getLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getLocator())() Method getLocator retrieves an instance of a SourceLocator object that specifies where an error occurred. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMessageAndLocation](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getMessageAndLocation())() Get the error message with location information appended. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [initCause](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#initCause(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Initializes the *cause* of this throwable to the specified value. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#printStackTrace())() Print the the trace of methods from where the error originated. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#printStackTrace(java.io.PrintWriter))([PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) s) Print the the trace of methods from where the error originated. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#printStackTrace(java.io.PrintStream))([PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) s) Print the the trace of methods from where the error originated. |
| void | [setLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#setLocator(javax.xml.transform.SourceLocator))([SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) location) Method setLocator sets an instance of a SourceLocator object that specifies where an error occurred. |

### Inherited Method Summary

From class [java.lang.Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)

|---|---|
| synchronized final void | [addSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) exception) Appends the specified exception to the exceptions that were suppressed in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [fillInStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#fillInStackTrace())() Fills in the execution stack trace. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause())() Returns the cause of this throwable or `null` if the cause is nonexistent or unknown. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLocalizedMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getLocalizedMessage())() Creates a localized description of this throwable. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getMessage())() Returns the detail message string of this throwable. |
| StackTraceElement\[\] | [getStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace())() Provides programmatic access to the stack trace information printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()`. |
| synchronized final [Throwable\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getSuppressed())() Returns an array containing all of the exceptions that were suppressed, typically by the `try`-with-resources statement, in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [initCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#initCause(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Initializes the *cause* of this throwable to the specified value. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace())() Prints this throwable and its backtrace to the standard error stream. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter))([PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) s) Prints this throwable and its backtrace to the specified print writer. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream))([PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) s) Prints this throwable and its backtrace to the specified print stream. |
| void | [setStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[]))(StackTraceElement\[\] stackTrace) Sets the stack trace elements that will be returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace()` and printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()` and related methods. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#toString())() Returns a short description of this throwable. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**TransformerException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message)

Create a new TransformerException.

##### Parameters

| message | The error or warning message. |
|---|---|

#### public
**TransformerException**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) e)

Create a new TransformerException wrapping an existing exception.

##### Parameters

| e | The exception to be wrapped. |
|---|---|

#### public
**TransformerException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) e)

Wrap an existing exception in a TransformerException.

This is used for throwing processor exceptions before
the processing has started.

<br />

##### Parameters

| message | The error or warning message, or null to use the message from the embedded exception. |
| e | Any exception |
|---|---|

#### public
**TransformerException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) locator)

Create a new TransformerException from a message and a Locator.

This constructor is especially useful when an application is
creating its own exception from within a DocumentHandler
callback.

<br />

##### Parameters

| message | The error or warning message. |
| locator | The locator object for the error or warning. |
|---|---|

#### public
**TransformerException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) locator, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) e)

Wrap an existing exception in a TransformerException.

##### Parameters

| message | The error or warning message, or null to use the message from the embedded exception. |
| locator | The locator object for the error or warning. |
| e | Any exception |
|---|---|

## Public Methods

#### public [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/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.)

##### Returns

- the cause of this throwable or `null` if the cause is nonexistent or unknown.

#### public [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)
**getException**
()

This method retrieves an exception that this exception wraps.

##### Returns

- An Throwable object, or null.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getCause()`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getLocationAsString**
()

Get the location information as a string.

##### Returns

- A string with location info, or null if there is no location information.

#### public [SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html)
**getLocator**
()

Method getLocator retrieves an instance of a SourceLocator
object that specifies where an error occurred.

##### Returns

- A SourceLocator object, or null if none was specified.

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getMessageAndLocation**
()

Get the error message with location information
appended.

##### Returns

- A `String` representing the error message with location information appended.

#### public synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)
**initCause**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause)

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 `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.Throwable)` or
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.String,%20java.lang.Throwable)`, this method cannot be called
even once.

##### Parameters

| cause | the cause (which is saved for later retrieval by the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#getCause()` method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) |
|---|---|

##### Returns

- a reference to this `Throwable` instance.

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `cause` is this throwable. (A throwable cannot be its own cause.) |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this throwable was created with `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.Throwable)` or `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerException.html#TransformerException(java.lang.String,%20java.lang.Throwable)`, or this method has already been called on this throwable. |
|---|---|

#### public void
**printStackTrace**
()

Print the the trace of methods from where the error
originated. This will trace all nested exception
objects, as well as this object.

#### public void
**printStackTrace**
([PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) s)

Print the the trace of methods from where the error
originated. This will trace all nested exception
objects, as well as this object.

##### Parameters

| s | The writer where the dump will be sent to. |
|---|---|

#### public void
**printStackTrace**
([PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) s)

Print the the trace of methods from where the error
originated. This will trace all nested exception
objects, as well as this object.

##### Parameters

| s | The stream where the dump will be sent to. |
|---|---|

#### public void
**setLocator**
([SourceLocator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/SourceLocator.html) location)

Method setLocator sets an instance of a SourceLocator
object that specifies where an error occurred.

##### Parameters

| location | A SourceLocator object, or null to clear the location. |
|---|---|