Class NucleusException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClassNotResolvedException, CommitStateTransitionException, IllegalStateTransitionException, NoQueryResultsException, NotYetFlushedException, NucleusCanRetryException, NucleusDataStoreException, NucleusEnhanceException, NucleusObjectNotFoundException, NucleusOptimisticException, NucleusTransactionException, NucleusUserException, PrimaryExpressionIsClassLiteralException, PrimaryExpressionIsClassStaticFieldException, PrimaryExpressionIsInvokeException, PrimaryExpressionIsVariableException, QueryInterruptedException, QueryTimeoutException, RollbackStateTransitionException, ValueGenerationException

public class NucleusException extends RuntimeException
Base exception thrown by DataNucleus.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • nested

      Throwable[] nested
      Array of nested Throwables (optional)
    • failed

      Object failed
      The object being processed when the error was encountered (optional).
    • fatal

      boolean fatal
      Flag defining if this exception is fatal, or could be retried with the possibility of success.
  • Constructor Details

    • NucleusException

      public NucleusException()
      Constructs a new exception without a detail message.
    • NucleusException

      public NucleusException(String msg)
      Constructs a new exception with the specified detail message.
      Parameters:
      msg - the detail message.
    • NucleusException

      public NucleusException(String msg, Throwable[] nested)
      Constructs a new exception with the specified detail message and nested Throwables.
      Parameters:
      msg - the detail message.
      nested - the nested Throwable[].
    • NucleusException

      public NucleusException(String msg, Throwable nested)
      Constructs a new exception with the specified detail message and nested Throwable.
      Parameters:
      msg - the detail message.
      nested - the nested Throwable.
    • NucleusException

      public NucleusException(String msg, Object failed)
      Constructs a new exception with the specified detail message and failed object.
      Parameters:
      msg - the detail message.
      failed - the failed object.
    • NucleusException

      public NucleusException(String msg, Throwable[] nested, Object failed)
      Constructs a new exception with the specified detail message, nested Throwables, and failed object.
      Parameters:
      msg - the detail message.
      nested - the nested Throwable[].
      failed - the failed object.
    • NucleusException

      public NucleusException(String msg, Throwable nested, Object failed)
      Constructs a new exception with the specified detail message, nested Throwable, and failed object.
      Parameters:
      msg - the detail message.
      nested - the nested Throwable.
      failed - the failed object.
  • Method Details

    • setFatal

      public NucleusException setFatal()
      Method to set the exception as being fatal. Returns the exception so that user code can call "throw new NucleusException(...).setFatal();"
      Returns:
      This exception (for convenience)
    • isFatal

      public boolean isFatal()
      Accessor for whether the exception is fatal, or retriable.
      Returns:
      Whether it is fatal
    • getFailedObject

      public Object getFailedObject()
      The exception may include a failed object.
      Returns:
      the failed object.
    • setNestedException

      public void setNestedException(Throwable nested)
    • getNestedExceptions

      public Throwable[] getNestedExceptions()
      The exception may have been caused by multiple exceptions in the runtime. If multiple objects caused the problem, each failed object will have its own Exception.
      Returns:
      the nested Throwable array.
    • getCause

      public Throwable getCause()
      Return the first nested exception (if any), otherwise null.
      Overrides:
      getCause in class Throwable
      Returns:
      the first or only nested Throwable.
    • printStackTrace

      public void printStackTrace()
      Prints this Exception and its backtrace to the standard error output. Print nested Throwables' stack trace as well.
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintStream s)
      Prints this Exception and its backtrace to the specified print stream. Print nested Throwables' stack trace as well.
      Overrides:
      printStackTrace in class Throwable
      Parameters:
      s - PrintStream to use for output
    • printStackTrace

      public void printStackTrace(PrintWriter s)
      Prints this Exception and its backtrace to the specified print writer. Print nested Throwables' stack trace as well.
      Overrides:
      printStackTrace in class Throwable
      Parameters:
      s - PrintWriter to use for output