uk.co.prosperosoftware.pspnum
Class PSPException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--uk.co.prosperosoftware.pspnum.PSPException
All Implemented Interfaces:
java.io.Serializable

public final class PSPException
extends java.lang.RuntimeException

Error thrown by other PSP* objects. Each PSPException object contains an error number value which can be determined using the getErrNum() method and then compared to one of the static error number variables defined for the class. Each PSPException object also supports a getErrFunction() method which gives you the name of the PSP method which generated the error. This is often - but not always - the top-level method you called in your code. Sometimes it is a lower level function.

Version:
4.4 05Jun2003
Author:
www.prosperosoftware.co.uk
See Also:
Serialized Form

Field Summary
static int BadDefaultNumFmt
          Error number 11 - thrown when you try to set the default format for a PSP numeric class (subsequently applied to each new object created for that class) to a value other than 'P' (for packed decimal format) or 'Z' (for zoned decimal format).
static int BadDimension
          Error number 12 - thrown when you try to set the dimension of a decimal array object to a value which 1) exceeds an upper limit for the array dimension (this limit is determined by each PSP class which throws this message) or 2) is less than one (each decimal numeric array object must have at least one element).
static int BadNumDigits
          Error number 22 - thrown when you try to set either DigitsBeforeDP or DigitsAfterDP such that the total of their two values 1) exceeds an upper limit for the total number of digits allowed in a numeric value (this limit is determined by each PSP class which throws this message) or 2) is less than one (every decimal numeric object must have a value length of at least one digit).
static int BadNumDigitsAfterDP
          Error number 21 - thrown when you try to set DigitsAfterDP to a value which 1) exceeds an upper limit for the number of digits allowed after the decimal place in a numeric value (this limit is determined by each PSP class which throws this message) or 2) is less than zero (no decimal numeric object can have a negative number of digits after the decimal place).
static int BadNumDigitsBeforeDP
          Error number 20 - thrown when you try to set DigitsBeforeDP to a value which 1) exceeds an upper limit for the number of digits allowed before the decimal place in a numeric value (this limit is determined by each PSP class which throws this message) or 2) is less than zero (no decimal numeric object can have a negative number of digits before the decimal place).
static int BadNumFmt
          Error number 19 - thrown when you try to set the format for a PSP numeric object (one instance) to a value other than 'P' (for packed decimal format) or 'Z' (for zoned decimal format).
static int BadPackNumHigh
          Error number 23 - thrown when one of the bytes in a byte array which holds a packed decimal value has an invalid value for a high-order nibble (half-byte) = left-hand four bits.
static int BadPackNumLow
          Error number 24 - thrown when one of the bytes in a byte array which holds a packed decimal value has an invalid value for a low-order nibble (half-byte) = right-hand four bits.
static int BadStringNumber
          Error number 27 - thrown when a String does not contain a valid numeric value.
static int BadZoneNumHigh
          Error number 30 - thrown when one of the bytes in a byte array which holds a zoned decimal value has an invalid value for a high-order nibble (half-byte) = left-hand four bits.
static int BadZoneNumLow
          Error number 31 - thrown when one of the bytes in a byte array which holds a zoned decimal value has an invalid value for a low-order nibble (half-byte) = right-hand four bits.
static int ByteArrayTooShort
          Error number 84 - thrown whan you pass a byte array as a parameter to a PSP function which is too short (length less than expected number of bytes) when checked by that function.
static int DivideByZero
          Error number 36 - thrown when you try to divide any decimal numeric value by another value (the divisor) which has a zero value at run-time.
static int HighBase
          Error number 79 - thrown when you try to set the base of a decimal array object to a value which exceeds an upper limit for the array base (this limit is determined by each PSP class which throws this message).
static int HighIndex
          Error number 62 - thrown when you try to set the current element of a decimal numeric array to a value (the index) which is beyond the end of the array.
static int LowBase
          Error number 80 - thrown when you try to set the base of a decimal array object to a value less than zero.
static int LowIndex
          Error number 64 - thrown when you try to set the current element of a decimal numeric array to a value (the index) which is before the start of the array.
static int NegativeRoot
          Error number 68 - thrown when you try to take the square root of a decimal number which has a negative value at run-time.
static int NotAscendSeq
          Error number 69 - thrown when an operation is done on a decimal numeric array that must be sorted into ascending sequence before the operation can be performed.
static int NotDescendSeq
          Error number 70 - thrown when an operation is done on a decimal numeric array that must be sorted into descending sequence before the operation can be performed.
static int NullInternalObject
          Error number 82 - thrown when an object (String, StringBuffer or byte array) passed internally from one PSP function to another tests equal to the 'null' value when checked by the called function.
static int NullObject
          Error number 73 - thrown when an object (String, StringBuffer or byte array) which you pass as a parameter to a PSP function tests equal to the 'null' value when checked by that function.
static int NumOverflow
          Error number 81 - thrown when a decimal numeric value would overflow (more digits before decimal place than allowed for that value) if an arithmetic or assignment operation were to proceed.
static int ObjRecImbalance
          Error number 74 - thrown when an operation internal to PSP (tracing calls in a stack) blows up.
static int ObjRecOverFlow
          Error number 75 - thrown when an operation internal to PSP (tracing calls in a stack) blows up.
static int ObjRecUnderFlow
          Error number 76 - thrown when an operation internal to PSP (tracing calls in a stack) blows up.
static int OutOfMemory
          Error number 77 - thrown when an object (typically a String, StringBuffer or byte array) which is created automatically within a PSP function using the Java 'new' operator tests equal to the 'null' value when checked by that function after creation.
 
Constructor Summary
PSPException()
          Constructs a PSPException with no detail message.
PSPException(int n, java.lang.String s)
          Constructs a PSPException with the specified detail message and error number.
PSPException(int n, java.lang.String s, java.lang.String f)
          Constructs a PSPException with the specified detail message, error number and error function.
PSPException(PSPException e)
          Constructs a copy of the PSPException parameter.
 
Method Summary
 java.lang.String getErrFunction()
          returns name of PSP function associated with this error.
 int getErrNum()
          returns PSP error number.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BadDefaultNumFmt

public static final int BadDefaultNumFmt
Error number 11 - thrown when you try to set the default format for a PSP numeric class (subsequently applied to each new object created for that class) to a value other than 'P' (for packed decimal format) or 'Z' (for zoned decimal format).

See Also:
Constant Field Values

BadDimension

public static final int BadDimension
Error number 12 - thrown when you try to set the dimension of a decimal array object to a value which 1) exceeds an upper limit for the array dimension (this limit is determined by each PSP class which throws this message) or 2) is less than one (each decimal numeric array object must have at least one element).

See Also:
Constant Field Values

BadNumFmt

public static final int BadNumFmt
Error number 19 - thrown when you try to set the format for a PSP numeric object (one instance) to a value other than 'P' (for packed decimal format) or 'Z' (for zoned decimal format).

See Also:
Constant Field Values

BadNumDigitsBeforeDP

public static final int BadNumDigitsBeforeDP
Error number 20 - thrown when you try to set DigitsBeforeDP to a value which 1) exceeds an upper limit for the number of digits allowed before the decimal place in a numeric value (this limit is determined by each PSP class which throws this message) or 2) is less than zero (no decimal numeric object can have a negative number of digits before the decimal place).

See Also:
Constant Field Values

BadNumDigitsAfterDP

public static final int BadNumDigitsAfterDP
Error number 21 - thrown when you try to set DigitsAfterDP to a value which 1) exceeds an upper limit for the number of digits allowed after the decimal place in a numeric value (this limit is determined by each PSP class which throws this message) or 2) is less than zero (no decimal numeric object can have a negative number of digits after the decimal place).

See Also:
Constant Field Values

BadNumDigits

public static final int BadNumDigits
Error number 22 - thrown when you try to set either DigitsBeforeDP or DigitsAfterDP such that the total of their two values 1) exceeds an upper limit for the total number of digits allowed in a numeric value (this limit is determined by each PSP class which throws this message) or 2) is less than one (every decimal numeric object must have a value length of at least one digit).

See Also:
Constant Field Values

BadPackNumHigh

public static final int BadPackNumHigh
Error number 23 - thrown when one of the bytes in a byte array which holds a packed decimal value has an invalid value for a high-order nibble (half-byte) = left-hand four bits. This nibble must be hexadecimal '0' through hexadecimal '9' representing an actual digit value (0-9).

See Also:
Constant Field Values

BadPackNumLow

public static final int BadPackNumLow
Error number 24 - thrown when one of the bytes in a byte array which holds a packed decimal value has an invalid value for a low-order nibble (half-byte) = right-hand four bits. This nibble must be hexadecimal 'D' or hexadecimal 'F' in the final low-order (right-hand) byte. This indicates the sign of the entire packed decimal value - negative or positive respectively. For all other bytes, this nibble must be hexadecimal '0' through hexadecimal '9' representing an actual digit value (0-9).

See Also:
Constant Field Values

BadStringNumber

public static final int BadStringNumber
Error number 27 - thrown when a String does not contain a valid numeric value. This might be due to an unexpected value for the decimal place character, or due to a number that can not be recognised as having a valid exponential format. Apart from the 'e' or 'E' used for exponential values, any alphabetic character will also trigger this error. Functions which throw this error typically return an integer value which indicates the position in the String of the detected error.

See Also:
Constant Field Values

BadZoneNumHigh

public static final int BadZoneNumHigh
Error number 30 - thrown when one of the bytes in a byte array which holds a zoned decimal value has an invalid value for a high-order nibble (half-byte) = left-hand four bits. This nibble must be hexadecimal 'D' or hexadecimal 'F' in the final low-order (right-hand) byte. This indicates the sign of the entire zoned decimal value - negative or positive respectively. For all other bytes, this nibble must simply be hexadecimal 'F'.

See Also:
Constant Field Values

BadZoneNumLow

public static final int BadZoneNumLow
Error number 31 - thrown when one of the bytes in a byte array which holds a zoned decimal value has an invalid value for a low-order nibble (half-byte) = right-hand four bits. This nibble must be hexadecimal '0' through hexadecimal '9' representing the actual digit value (0-9).

See Also:
Constant Field Values

DivideByZero

public static final int DivideByZero
Error number 36 - thrown when you try to divide any decimal numeric value by another value (the divisor) which has a zero value at run-time.

See Also:
Constant Field Values

HighIndex

public static final int HighIndex
Error number 62 - thrown when you try to set the current element of a decimal numeric array to a value (the index) which is beyond the end of the array. The final element of the array has an index given by the value (Base + Dimension - 1).

See Also:
Constant Field Values

LowIndex

public static final int LowIndex
Error number 64 - thrown when you try to set the current element of a decimal numeric array to a value (the index) which is before the start of the array. The first element of the array has an index given by the Base value (or zero if Base is not set otherwise).

See Also:
Constant Field Values

NegativeRoot

public static final int NegativeRoot
Error number 68 - thrown when you try to take the square root of a decimal number which has a negative value at run-time.

See Also:
Constant Field Values

NotAscendSeq

public static final int NotAscendSeq
Error number 69 - thrown when an operation is done on a decimal numeric array that must be sorted into ascending sequence before the operation can be performed.

See Also:
Constant Field Values

NotDescendSeq

public static final int NotDescendSeq
Error number 70 - thrown when an operation is done on a decimal numeric array that must be sorted into descending sequence before the operation can be performed.

See Also:
Constant Field Values

NullObject

public static final int NullObject
Error number 73 - thrown when an object (String, StringBuffer or byte array) which you pass as a parameter to a PSP function tests equal to the 'null' value when checked by that function. This typically occurs when you declare a variable of one of these object types, but fail to initialise it with the Java 'new' operator.

See Also:
Constant Field Values

ObjRecImbalance

public static final int ObjRecImbalance
Error number 74 - thrown when an operation internal to PSP (tracing calls in a stack) blows up. You should never see this message - it represents a failure of our internal code.

See Also:
Constant Field Values

ObjRecOverFlow

public static final int ObjRecOverFlow
Error number 75 - thrown when an operation internal to PSP (tracing calls in a stack) blows up. You should never see this message - it represents a failure of our internal code.

See Also:
Constant Field Values

ObjRecUnderFlow

public static final int ObjRecUnderFlow
Error number 76 - thrown when an operation internal to PSP (tracing calls in a stack) blows up. You should never see this message - it represents a failure of our internal code.

See Also:
Constant Field Values

OutOfMemory

public static final int OutOfMemory
Error number 77 - thrown when an object (typically a String, StringBuffer or byte array) which is created automatically within a PSP function using the Java 'new' operator tests equal to the 'null' value when checked by that function after creation. This error message should be very rare.

See Also:
Constant Field Values

HighBase

public static final int HighBase
Error number 79 - thrown when you try to set the base of a decimal array object to a value which exceeds an upper limit for the array base (this limit is determined by each PSP class which throws this message).

See Also:
Constant Field Values

LowBase

public static final int LowBase
Error number 80 - thrown when you try to set the base of a decimal array object to a value less than zero.

See Also:
Constant Field Values

NumOverflow

public static final int NumOverflow
Error number 81 - thrown when a decimal numeric value would overflow (more digits before decimal place than allowed for that value) if an arithmetic or assignment operation were to proceed. The handling of overflow is determined by each PSP class that throws this message.

See Also:
Constant Field Values

NullInternalObject

public static final int NullInternalObject
Error number 82 - thrown when an object (String, StringBuffer or byte array) passed internally from one PSP function to another tests equal to the 'null' value when checked by the called function. This may occur because our internal code declares a variable of one of these object types, but fails to initialise it correctly with the Java 'new' operator. Or it may occur following an OutOfMemory error (see error number 77 above). This error message should be very rare.

See Also:
Constant Field Values

ByteArrayTooShort

public static final int ByteArrayTooShort
Error number 84 - thrown whan you pass a byte array as a parameter to a PSP function which is too short (length less than expected number of bytes) when checked by that function. Typically occurs when the byte array contains a zoned or packed decimal value where you have miscalculated the length required to suit the number of digits in the decimal numeric value within the PSP object.

See Also:
Constant Field Values
Constructor Detail

PSPException

public PSPException()
Constructs a PSPException with no detail message.


PSPException

public PSPException(int n,
                    java.lang.String s)
Constructs a PSPException with the specified detail message and error number.

Parameters:
n - The error number.
s - The error message.

PSPException

public PSPException(int n,
                    java.lang.String s,
                    java.lang.String f)
Constructs a PSPException with the specified detail message, error number and error function.

Parameters:
n - The error number.
s - The error message.

PSPException

public PSPException(PSPException e)
Constructs a copy of the PSPException parameter.

Parameters:
e - The PSPException to be copied.
Method Detail

getErrNum

public int getErrNum()
returns PSP error number.


getErrFunction

public java.lang.String getErrFunction()
returns name of PSP function associated with this error.