Class RemoteWrappedException

All Implemented Interfaces:
Serializable

public final class RemoteWrappedException extends ConnectorException
RemoteWrappedException wraps every exception which are received from Remote Connector Server.

This Exception is not allowed to use in Connectors!!!

This type of exception is not allowed to be serialise because this exception represents any after deserialization. This code example show how to get the remote stack trace and how to use the same catches to handle the exceptions regardless its origin.

 
  String stackTrace = null;
  try {
      try {
          facade.getObject(ObjectClass.ACCOUNT, uid, null);
      } catch (RemoteWrappedException e) {
          stackTrace = e.getStackTrace()
      }
  } catch (Throwable t) {
      if (null != stackTrace) {
          System.err.println(stackTrace);
      } else {
          t.printStackTrace();
      }
  }
 
 
Since:
1.4
Author:
Laszlo Hordos
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getExceptionClass

      public String getExceptionClass()
      Gets the class name of the original exception. This value is constructed by throwable.getClass().getName().
      Returns:
      name of the original exception.
    • is

      public boolean is(Class<? extends Throwable> expected)
      Checks if the exception is the expected class.
      Parameters:
      expected - the expected throwable class.
      Returns:
      true if the class name are equals.
    • getCause

      public RemoteWrappedException getCause()
      Returns the cause of original throwable or null if the cause is nonexistent or unknown. (The cause is the throwable that caused the original throwable to get thrown.)
      Overrides:
      getCause in class Throwable
      Returns:
      the cause of this throwable or null if the cause is nonexistent or unknown.
    • printStackTrace

      public void printStackTrace(PrintStream s)
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintWriter s)
      Overrides:
      printStackTrace in class Throwable
    • readStackTrace

      public String readStackTrace()
    • getStackTrace

      public static String getStackTrace(Throwable throwable)
      Gets the stack trace from a Throwable as a String.
      Parameters:
      throwable - the Throwable to be examined
      Returns:
      the stack trace as generated by the exception's printStackTrace(PrintWriter) method
    • wrap

      public static RemoteWrappedException wrap(Throwable ex)
      Wraps the Throwable into a RemoteWrappedException instance.
      Parameters:
      ex - Exception to wrap or cast and return.
      Returns:
      a RemoteWrappedException that either is the specified exception or contains the specified exception.
    • convert

      public static HashMap<String,Object> convert(Throwable throwable)
      Converts the throwable object to a new Map object that representing itself.
      Parameters:
      throwable - the Throwable to be converted
      Returns:
      the Map representing the throwable.