Package wt.util

Class WTException

All Implemented Interfaces:
Serializable, LocalizableMessage, Message
Direct Known Subclasses:
AccessControlException, AdministrativeDomainException, AlreadyCheckedOutException, ChangeException2, CheckedOutByOtherException, CheckInOutException, ClassificationReportException, CollectionContainsDeletedException, CollectionContainsStaleException, CommandException, ConfigException, ConflictException, ConstraintException, ContentException, DeleteCompletedException, wt.effectivity.EffectivityException, EffGroupException, EPMException, EPMNonOverrideableConflictException, ESIException, ESITargetAssignmentException, FederationServicesException, FolderException, IllegalContentException, IllegalFormatException, IncompatibleUnitsException, IndexPolicyException, InvalidAlgorithmArgumentException, InvalidAttributeException, InvalidFunctionArgumentException, InvalidNavigateSourceException, InvalidRoleException, LifeCycleException, LockException, ManagerException, MappingManagerException, MaturityException, ModificationNotAllowedException, NonEventFailedException, NotCheckedOutException, ObjectNoLongerExistsException, ObjectNotForLinkException, wt.objectstorage.exception.ObjectStorageException, OccurrenceException, OrganizationServicesException, OwnershipException, PartialContentControlLinkResultException, PersistenceException, QMLException, QueryException, QueryException, QueueException, ReceivedDeliveryException, ReplicaException, ReservationException, ResetReadyException, ReviseException, RouterException, SchedulerException, SeriesException, SignatureInvalidException, StringLimitException, TaskDelegateException, TeamException, TranslationException, UnitFormatException, VersionControlException, ViewException, ViewMarkUpException, WfException, WorkInProgressException, wt.inf.container.WTContainerException, WTDeliveryException, WTIntrospectionException, WTResourceException, XPathException

public class WTException extends Exception implements LocalizableMessage
WTException is the base class for Windchill exceptions.

WTException is an exception that:

  • May embed exceptions and errors thrown by lower level methods.
  • Support localizable messages.
The following is an example of how a method would construct a WTException:
    try {
       doSomething(obj);
    }
    catch (Exception e) {
       Object[] param = { toString(), obj.getConceptualClassname() };
       throw new WTException(e, RESOURCE, "17", param);
    }
 
Localization of the WTException messages relies on the resource bundle and text formatting features of Java. In the example above, RESOURCE is a string constant that identifies the resource bundle containing the localizable message for the exception.



Supported API: true

Extendable: true

See Also:
  • Constructor Details

    • WTException

      public WTException()
      Constructs a Windchill exception with no specified detailed message or embedded throwable object.

      Supported API: true
    • WTException

      public WTException(WTMessage message)
      Constructs a Windchill exception given the passed-in message.

      Supported API: true
      Parameters:
      message - the message
    • WTException

      public WTException(Object[] additionalMessages)
      Constructs a Windchill exception with additional messages only.

      Supported API: true
      Parameters:
      additionalMessages - the array of additional messages
    • WTException

      public WTException(WTMessage message, Object[] additionalMessages)
      Constructs a Windchill exception with a standard message and additional messages.

      Supported API: true
      Parameters:
      message - the standard message
      additionalMessages - the array of additional messages
    • WTException

      public WTException(String s)
      Constructs a Windchill exception with a non-localizable detailed message.

      Supported API: true
      Parameters:
      s - the detailed message
    • WTException

      public WTException(String s, Object[] additionalMessages)
      Constructs a Windchill exception with a non-localizable standard message and additional messages.

      Supported API: true
      Parameters:
      s - the standard message
      additionalMessages - the array of additional messages
    • WTException

      public WTException(String rb, String key, Object[] params)
      Constructs a Windchill exception with a localizable standard message constructed from the bundle, key, and params.

      Supported API: true
      Parameters:
      rb - the resoure bundle the key resides in
      key - the key containing the message in the resource bundle
      params - the parameters to substitute in the message
    • WTException

      public WTException(String rb, String key, Object[] params, Object[] additionalMessages)
      Constructs a Windchill exception with a localizable standard message constructed from the bundle, key, and params.

      Supported API: true
      Parameters:
      rb - the resoure bundle the key resides in
      key - the key containing the message in the resource bundle
      params - the parameters to substitute in the message
      additionalMessages - the array of additional messages
    • WTException

      public WTException(Throwable t)
      Constructs a Windchill exception with a nested throwable.

      Supported API: true
      Parameters:
      t - the nested throwable
    • WTException

      public WTException(Throwable t, WTMessage message)
      Constructs a Windchill exception with a nested throwable and message.

      Supported API: true
      Parameters:
      t - the nested throwable
      message - the message
    • WTException

      public WTException(Throwable t, Object[] additionalMessages)
      Constructs a Windchill exception with a nested throwable and additional messages.

      Supported API: true
      Parameters:
      t - the nested throwable
      additionalMessages - the array of additional messages
    • WTException

      public WTException(Throwable t, WTMessage message, Object[] additionalMessages)
      Constructs a Windchill exception with a nested throwable, message, and additional messages.

      Supported API: true
      Parameters:
      t - the nested throwable
      message - the message
      additionalMessages - the array of additional messages
    • WTException

      public WTException(Throwable t, String s)
      Constructs a Windchill exception with an embedded Throwable object and non-localizable detailed message.

      Supported API: true
      Parameters:
      t - the embedded Throwable. It may be null.
      s - the detailed message. It may be null.
    • WTException

      public WTException(Throwable t, String s, Object[] additionalMessages)
      Constructs a Windchill exception with an embedded Throwable object, a non-localizable detailed message, and additional messages.

      Supported API: true
      Parameters:
      t - the embedded Throwable. It may be null.
      s - the detailed message. It may be null.
      additionalMessages - the array of additional messages. It may be null.
    • WTException

      public WTException(Throwable t, String rb, String key, Object[] params)
      Constructs a Windchill exception with an embedded Throwable object and a localizable detailed message.

      Supported API: true
      Parameters:
      t - the embedded Throwable. It may be null.
      rb - the name of the base resource bundle subclass containing the localizable message.
      key - the key associated with the localizable message
      params - an optional set of objects to be formatted into the localizable message text.
      See Also:
    • WTException

      public WTException(Throwable t, String rb, String key, Object[] params, Object[] additionalMessages)
      Constructs a Windchill exception with an embedded Throwable object, a localizable detailed message, and additional messages.

      Supported API: true
      Parameters:
      t - the embedded Throwable. It may be null.
      rb - the name of the base resource bundle subclass containing the localizable message.
      key - the key associated with the localizable message
      params - an optional set of objects to be formatted into the localizable message text.
      additionalMessages - the array of additional messages. It may be null.
      See Also:
  • Method Details

    • getNestedThrowable

      public Throwable getNestedThrowable()
      Returns the embedded throwable object.

      Supported API: true
    • getWTMessage

      public WTMessage getWTMessage()
      Returns the raw WTMessage object (which may be null).

      Supported API: true
    • getLocalizedMessage

      public String getLocalizedMessage()
      Returns the localized message, including nested exception.

      Supported API: true
      Overrides:
      getLocalizedMessage in class Throwable
    • getLocalizedMessage

      public String getLocalizedMessage(Locale locale, boolean nested)
      Returns the localized message, for the specified locale, optionally including nested exception.

      Supported API: true
      Parameters:
      nested - include nested exceptions in message
    • getLocalizedMessage

      public String getLocalizedMessage(boolean nested)
      Returns the localized message, optionally including nested exception.

      Supported API: true
      Parameters:
      nested - include nested exceptions in message
    • getNestedExceptionString

      public static String getNestedExceptionString(String msg, Locale locale)
      Returns the localized form of a "nested exception is" string. The format of the returned string is based on the last character of the message to which this string will be appended.

      Supported API: true
      Parameters:
      msg - current message
      locale - Locale to use
    • getNestedExceptionString

      public static String getNestedExceptionString(String msg)
      Returns the localized form of a "nested exception is" string. The format of the returned string is based on the last character of the message to which this string will be appended.

      Supported API: true
      Parameters:
      msg - current message
    • printStackTrace

      public void printStackTrace()
      Prints this WTException and the backtrace of its most deeply nested embedded Throwable to the standard error stream.

      Supported API: true
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintStream s)
      Prints this WTException and the backtrace of its most deeply nested embedded Throwable to the specified print stream.

      Supported API: true
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintWriter s)
      Prints this WTException and the backtrace of its most deeply nested embedded Throwable to the specified print writer.

      Supported API: true
      Overrides:
      printStackTrace in class Throwable
    • setLocalizedMessage

      protected void setLocalizedMessage(String rb, String key, Object[] params)
      Sets the localized message for this WTException.
      Parameters:
      rb - the name of the base resource bundle subclass containing the localizable message.
      key - the key associated with the localizable message
      params - an optional set of objects to be formatted into the localizable message text.

      Supported API: true
      See Also:
    • toString

      public String toString()
      Returns a description of this WTException. The description includes the descriptions of the nested throwable objects that are embedded within this WTException.

      Supported API: true
      Overrides:
      toString in class Throwable
    • toString

      public String toString(boolean nested)
      Returns a description of this WTException. The description optionally includes the descriptions of the nested throwable objects that are embedded within this WTException.

      Supported API: true
      Parameters:
      nested - include nested exceptions in message
    • getStandardMessage

      public String getStandardMessage()
      Returns the localized "standard" message. The standard message is the string or localized message passed during the construction of this object.

      Supported API: true
    • getStandardMessage

      public String getStandardMessage(Locale locale)
      Returns the localized "standard" message using the given locale. The standard message is the string or localized message passed during the construction of this object.

      Supported API: true
      Parameters:
      locale - the locale to apply when localizing the standard message
    • getAdditionalMessageArray

      public Object[] getAdditionalMessageArray()
      Returns the raw "additional" messages object array. This is the array of objects passed during the construction of this object.

      Supported API: true
    • getAdditionalMessages

      public String getAdditionalMessages()
      Returns the localized "additional" messages. The additional messages consist of the array of objects passed during the construction of this object. Each object in the array is localized and each localized result is separated from the other by a newline.

      Supported API: true
    • getAdditionalMessages

      public String getAdditionalMessages(Locale locale)
      Returns the localized "additional" messages. The additional messages consist of the array of objects passed during the construction of this object. Each object in the array is localized and each localized result is separated from the other by a newline.

      Supported API: true
      Parameters:
      locale - the locale to apply when localizing the standard message