DJAVA

au.gov.aao.drama
Class DramaError

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Error
          extended by au.gov.aao.drama.DramaError
All Implemented Interfaces:
Serializable

public class DramaError
extends Error

Objects of this class are used to convert a checked DramaException to an unchecked expection. This allows methods to be implemented which don't force the compiler to check if the exception is handled.

Note that if the exception is never handled, the thread is likely to be killed, possibly in an unclean way - with the result that other DRAMA tasks may not know about this task disappearing.

All the appropiate methods of DramaException are reproduced.

The following bit of code will catch a DramaException and convert it to a DramaError.

  catch (DramaException e) {
      throw new DramaError(e);
  }
  

Thanks to Bruce Eckel's page here for some of these ideas.

Version:
@(#) $Id: ACMM:DramaJava/DramaError.java,v 3.52 17-Sep-2009 14:08:18+10 tjf $
Author:
Tony Farrell
See Also:
DramaException, DramaStatus, DramaTask, Serialized Form

Field Summary
static String RCSID
          The RCS (ACMM) ID.
 
Constructor Summary
DramaError(DramaException e)
          Creates a DRAMA Error (unchecked exception) object from a DramaException.
DramaError(String detailString, DramaStatus status)
          Creates a DRAMA Error (unchecked exception) object, with the assocaited DRAMA status passed using a DramaStatus object.
DramaError(String detailString, int status)
          Creates a DRAMA Error (unchecked exception) object, with the assocaited DRAMA status passed as an integer.
 
Method Summary
 DramaStatus DramaStatus()
          Return the DRAMA status code associated with an exception.
protected  int DramaStatusInt()
          Return the DRAMA status code associated with an exception.
 DramaException GetDramaException()
          Returns a reference to the underlying Drama Exception object
static void main(String[] args)
           
 void rethrow()
          Re-throw the underlying exception.
 String toString()
          Returns a string representation of a DRAMA Exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RCSID

public static final String RCSID
The RCS (ACMM) ID. This field returns the source code archive ID of this class's source file.

The returned string corresponds to the version string seen above (in the class description comments), but will contain the version details of the compiled class file's actual source file.

(ACMM is the source code archive system used by the AAO. If the string returned by RCSID does not contain the string ACMM, then it is likely the source code has been archived again outside the AAO).

See Also:
Constant Field Values
Constructor Detail

DramaError

public DramaError(String detailString,
                  int status)
Creates a DRAMA Error (unchecked exception) object, with the assocaited DRAMA status passed as an integer.

Parameters:
detailString - A string giving context for the error.
status - The DRAMA Status code for the error. If this exception is ever converted back to a DRAMA error report, this code can be fetched and associated with the DRAMA error report.

DramaError

public DramaError(String detailString,
                  DramaStatus status)
Creates a DRAMA Error (unchecked exception) object, with the assocaited DRAMA status passed using a DramaStatus object.

Parameters:
detailString - A string giving context for the error.
status - The DRAMA Status code for the error. If this exception is ever converted back to a DRAMA error report, this code can be fetched and associated with the DRAMA error report.

DramaError

public DramaError(DramaException e)
Creates a DRAMA Error (unchecked exception) object from a DramaException.

Parameters:
e - The original (checked) exception.
Method Detail

DramaStatus

public DramaStatus DramaStatus()
Return the DRAMA status code associated with an exception.

Returns:
The Drama Status associated with the exception.

DramaStatusInt

protected int DramaStatusInt()
Return the DRAMA status code associated with an exception. This version is used by the C++ routine DramaCheckAndCvt(). It is not intended to be used from Java, but must be protected rather then private to ensure the native code can access it.

Returns:
The Drama Status associated with the exception as an integer.

toString

public String toString()
Returns a string representation of a DRAMA Exception.

Overrides:
toString in class Throwable
Returns:
The exception details as a string.

GetDramaException

public DramaException GetDramaException()
Returns a reference to the underlying Drama Exception object

Returns:
The underlying exception object.

rethrow

public void rethrow()
             throws DramaException
Re-throw the underlying exception.

Throws:
DramaException - The underlying exception

main

public static void main(String[] args)

DJAVA

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aaoepp.aao.gov.au.