Package Torello.JavaDoc
Class UpgradeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.IllegalArgumentException
-
- Torello.JavaDoc.UpgradeException
-
- All Implemented Interfaces:
java.io.Serializable
public class UpgradeException extends java.lang.IllegalArgumentException
Exception that may be thrown when building anUpgrade
class instance.
If there are any exceptions when building or running theUpgrade
class, this exception will throw. This is sometimes used as a wrapper-exception.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/UpgradeException.java
- Open New Browser-Tab: Torello/JavaDoc/UpgradeException.java
File Size: 5,137 Bytes Line Count: 136 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description UpgradeException()
Constructs anUpgradeException
with no detail message.UpgradeException(String message)
Constructs anUpgradeException
with the specified detail message.UpgradeException(String message, Throwable cause)
Constructs a new exception with the specified detail message and cause.UpgradeException(Throwable cause)
Constructs a new exception with the specified cause and a detail message of(cause==null ? null : cause.toString())
(which typically contains the class and detail message of cause).
-
Method Summary
'static'
Exception Check MethodsModifier and Type Method static void
checkFileExistsAndCanAccess(String fileOrDirectoryName, String fileOrDirectoryTypeMessage)
static void
checkFileIsWriteable(String fileName, String fileTypeMessage, String initStr)
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
Note that Java'sjava.lang.Exception
andjava.lang.Error
classes implement theSerializable interface
, and a warning-free build expects this field be defined here.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final long serialVersionUID = 1;
-
-
Constructor Detail
-
UpgradeException
public UpgradeException()
Constructs anUpgradeException
with no detail message.
-
UpgradeException
public UpgradeException(java.lang.String message)
Constructs anUpgradeException
with the specified detail message.- Parameters:
message
- the detail message.
-
UpgradeException
public UpgradeException(java.lang.String message, java.lang.Throwable cause)
Constructs a new exception with the specified detail message and cause.
NOTE:
The detail message associated with cause is not automatically incorporated into this exception's detail message.- Parameters:
message
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method).cause
- the cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
UpgradeException
public UpgradeException(java.lang.Throwable cause)
Constructs a new exception with the specified cause and a detail message of(cause==null ? null : cause.toString())
(which typically contains the class and detail message of cause).
This constructor is useful for exceptions that are little more than wrappers for other throwables.- Parameters:
cause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
-
Method Detail
-
checkFileExistsAndCanAccess
public static void checkFileExistsAndCanAccess (java.lang.String fileOrDirectoryName, java.lang.String fileOrDirectoryTypeMessage)
Simple error checking to ensure that a file exists, and that it is accessible.- Parameters:
fileOrDirectoryName
- This is the file (or directory) to be checked for existence and security privileges.fileOrDirectoryTypeMessage
- This message will be used in error or exception messages if the check fails.- Throws:
UpgradeException
- If there are any problems loading the file, or reading from it, then this exception will throw.JavaDocError
- This will throw if Java throws a serious error. This is unlikely, but given that file-system problems should be dealt with immediately, if they occur, catching Java Error's is taken seriously here.- Code:
- Exact Method Body:
try { if (! ((new java.io.File(fileOrDirectoryName)).exists())) throw new UpgradeException( fileOrDirectoryTypeMessage + " does not exist, or is not found:\n" + "[" + fileOrDirectoryName + "]" ); } catch (UpgradeException ue) { throw ue; } catch (Exception e) { throw new UpgradeException( "There was an Error attempting to access" + fileOrDirectoryTypeMessage + '\n' + "[" + fileOrDirectoryName + "]\n"+ "due to a(n) [" + e.getClass().getSimpleName() + "] throw.\n" + "Please see Throwable.getCause() for Details.", e ); }
-
checkFileIsWriteable
public static void checkFileIsWriteable(java.lang.String fileName, java.lang.String fileTypeMessage, java.lang.String initStr)
Simple error checking to ensure that write access is available to a file-name.- Parameters:
fileName
- This is the file to be checked for write-access privileges.fileTypeMessage
- This message will be used in error or exception messages if the check fails.initStr
- This is the initialization string to write to the file. This parameter may be null, and if it is an empty string will be written.- Throws:
UpgradeException
- If there are any problems writing to the file, then this exception will throw.- Code:
- Exact Method Body:
try { FileRW.writeFile((initStr != null) ? initStr : "", fileName); } catch (Exception e) { throw new UpgradeException( "Unable to write " + fileTypeMessage + ":\n" + fileName + '\n' + "due to a(n) [" + e.getClass().getSimpleName() + "] throw.\n" + "Please see Throwable.getCause() for Details.", e ); }
-
-