dk.netarkivet.common.utils.batch
Class FileBatchJob.ExceptionOccurrence

java.lang.Object
  extended by dk.netarkivet.common.utils.batch.FileBatchJob.ExceptionOccurrence
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
FileBatchJob

public static class FileBatchJob.ExceptionOccurrence
extends java.lang.Object
implements java.io.Serializable

This class holds the information about exceptions that occurred in a batchjob.

See Also:
Serialized Form

Field Summary
static long UNKNOWN_OFFSET
          Marker for the case when we couldn't find an offset for the outputstream.
 
Constructor Summary
FileBatchJob.ExceptionOccurrence(boolean inInitialize, long outputOffset, java.lang.Exception exception)
          Constructor for ExceptionOccurrence when an exception happened during initialize() or finish().
FileBatchJob.ExceptionOccurrence(java.io.File file, long fileOffset, long outputOffset, java.lang.Exception exception)
          Standard Constructor for ExceptionOccurrence.
 
Method Summary
 java.lang.Exception getException()
          The exception that was thrown.
 java.lang.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().
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

FileBatchJob.ExceptionOccurrence

public FileBatchJob.ExceptionOccurrence(java.io.File file,
                                        long fileOffset,
                                        long outputOffset,
                                        java.lang.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.

FileBatchJob.ExceptionOccurrence

public FileBatchJob.ExceptionOccurrence(boolean inInitialize,
                                        long outputOffset,
                                        java.lang.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 java.lang.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 java.lang.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().

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a Human readable representation of this ExceptionOccurence object.