org.apache.struts2

## Class StrutsException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.apache.struts2.StrutsException

- All Implemented Interfaces:
    Locatable, Serializable
  Direct Known Subclasses:
    ConfigurationException, ReflectionException, TypeConversionException

      public class StrutsException
      extends RuntimeException
      implements Locatable

  A generic runtime exception that optionally contains Location information
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsException()` Constructs a `StrutsException` with no detail message.
    `StrutsException(String s)` Constructs a `StrutsException` with the specified detail message.
    `StrutsException(String s, Object target)` Constructs a `StrutsException` with the specified detail message and target.
    `StrutsException(String s, Throwable cause)` Constructs a `StrutsException` with the specified detail message and exception cause.
    `StrutsException(String s, Throwable cause, Object target)` Constructs a `StrutsException` with the specified detail message, cause, and target
    `StrutsException(Throwable cause)` Constructs a `StrutsException` with the root cause
    `StrutsException(Throwable cause, Object target)` Constructs a `StrutsException` with the root cause and target

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Location` | `getLocation()` Gets the location of the error, if available
    `String` | `toString()` Returns a short description of this throwable object, including the location.

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### StrutsException

          public StrutsException()

      Constructs a `StrutsException` with no detail message.

    - #### StrutsException

          public StrutsException(String s)

      Constructs a `StrutsException` with the specified detail message.
      Parameters:
        `s` - the detail message.

    - #### StrutsException

          public StrutsException(String s,
                                 Object target)

      Constructs a `StrutsException` with the specified detail message and target.
      Parameters:
        `s` - the detail message.
        `target` - the target of the exception.

    - #### StrutsException

          public StrutsException(Throwable cause)

      Constructs a `StrutsException` with the root cause
      Parameters:
        `cause` - The wrapped exception

    - #### StrutsException

          public StrutsException(Throwable cause,
                                 Object target)

      Constructs a `StrutsException` with the root cause and target
      Parameters:
        `cause` - The wrapped exception
        `target` - The target of the exception

    - #### StrutsException

          public StrutsException(String s,
                                 Throwable cause)

      Constructs a `StrutsException` with the specified detail message and exception cause.
      Parameters:
        `s` - the detail message.
        `cause` - the wrapped exception

    - #### StrutsException

          public StrutsException(String s,
                                 Throwable cause,
                                 Object target)

      Constructs a `StrutsException` with the specified detail message, cause, and target
      Parameters:
        `s` - the detail message.
        `cause` - The wrapped exception
        `target` - The target of the exception

  - ### Method Detail

    - #### getLocation

          public Location getLocation()

      Gets the location of the error, if available
      Specified by:
        `getLocation` in interface `Locatable`
      Returns:
        the location, `null` if not available

    - #### toString

          public String toString()

      Returns a short description of this throwable object, including the location. If no detailed message is available, it will use the message of the underlying exception if available.
      Overrides:
        `toString` in class `Throwable`
      Returns:
        a string representation of this `Throwable`.

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.