Package dk.netarkivet.common.utils.batch
Class FileBatchJob.ExceptionOccurrence
- java.lang.Object
-
- dk.netarkivet.common.utils.batch.FileBatchJob.ExceptionOccurrence
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- FileBatchJob
public static class FileBatchJob.ExceptionOccurrence extends Object implements Serializable
This class holds the information about exceptions that occurred in a batchjob.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static long
UNKNOWN_OFFSET
Marker for the case when we couldn't find an offset for the outputstream.
-
Constructor Summary
Constructors Constructor Description ExceptionOccurrence(boolean inInitialize, long outputOffset, Exception exception)
Constructor for ExceptionOccurrence when an exception happened during initialize() or finish().ExceptionOccurrence(File file, long fileOffset, long outputOffset, Exception exception)
Standard Constructor for ExceptionOccurrence.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Exception
getException()
The exception that was thrown.String
getFileName()
Get the name of the file that this exception occurred in.long
getFileOffset()
Get the offset into the file that this exception occurred at.long
getOutputOffset()
Offset of the output stream when this exception occurred.boolean
isFinishException()
Returns true if the exception was thrown during finish().boolean
isInitializeException()
Returns true if the exception was thrown during initialize().String
toString()
-
-
-
Field Detail
-
UNKNOWN_OFFSET
public static final long UNKNOWN_OFFSET
Marker for the case when we couldn't find an offset for the outputstream.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExceptionOccurrence
public ExceptionOccurrence(File file, long fileOffset, long outputOffset, Exception exception)
Standard Constructor for ExceptionOccurrence.- Parameters:
file
- The file that caused the exception.fileOffset
- The relevant offset into the file when the exception happened (e.g. the start of an ARC record).outputOffset
- The offset we were at in the outputstream when the exception happened.exception
- The exception thrown. This exception must be serializable.- See Also:
for details on the parameters.
-
ExceptionOccurrence
public ExceptionOccurrence(boolean inInitialize, long outputOffset, Exception exception)
Constructor for ExceptionOccurrence when an exception happened during initialize() or finish().- Parameters:
inInitialize
- True if the exception happened in initialize()outputOffset
- Current offset in the output stream, or UNKNOWN_OFFSET if the offset cannot be found.exception
- The exception that was thrown.
-
-
Method Detail
-
getFileName
public String getFileName()
Get the name of the file that this exception occurred in.- Returns:
- Name of the file that this exception occurred in, or null if it happened during initialize() or finish().
-
getFileOffset
public long getFileOffset()
Get the offset into the file that this exception occurred at. This location may not be exactly where the problem that caused the exception occurred, but may be e.g. at the start of a corrupt record.- Returns:
- Offset into the file that this exception occurred at, or UNKNOWN_OFFSET if it happened during initialize() or finish().
-
getOutputOffset
public long getOutputOffset()
Offset of the output stream when this exception occurred.- Returns:
- Offset in output stream, or UNKNOWN_OFFSET if the offset could not be determined.
-
getException
public Exception getException()
The exception that was thrown.- Returns:
- An exception.
-
isInitializeException
public boolean isInitializeException()
Returns true if the exception was thrown during initialize(). In that case, no processing has taken place, but finish() has been called.- Returns:
- true if the exception was thrown during initialize()
-
isFinishException
public boolean isFinishException()
Returns true if the exception was thrown during finish().- Returns:
- true if the exception was thrown during finish().
-
-