de.schlichtherle.io
Class ArchiveException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by de.schlichtherle.io.ChainableIOException
                  extended by de.schlichtherle.io.ArchiveException
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ArchiveBusyException, ArchiveWarningException

public class ArchiveException
extends ChainableIOException

Represents a chain of exceptions thrown by the File.umount() and File.update() methods to indicate an error condition which does incur loss of data.

Both methods catch any exceptions occuring throughout their processing and store them in an exception chain until all archive files have been updated. Finally, if the exception chain is not empty, it's reordered and thrown so that if its head is an instance of ArchiveWarningException, only instances of this class or its subclasses are in the chain, but no instances of ArchiveException or its subclasses (except ArchiveWarningException, of course).

This enables client applications to do a simple case distinction with a try-catch-block like this to react selectively:


 try {
     File.umount();
 } catch (ArchiveWarningException warning) {
     // Only warnings have occured and no data has been lost - ignore this.
 } catch (ArchiveException error) {
     // Some data has been lost - panic!
     error.printStackTrace();
 }
 

Since:
TrueZIP 6.0 (refactored from the predecessor class ArchiveControllerException)
Version:
TrueZIP 6.7
Author:
Christian Schlichtherle
See Also:
Serialized Form

Constructor Summary
ArchiveException(ArchiveException priorException)
          Constructs a new exception with the specified prior exception.
ArchiveException(ArchiveException priorException, IOException cause)
          Constructs a new exception with the specified prior exception and the cause.
ArchiveException(ArchiveException priorException, String message)
          Constructs a new exception with the specified prior exception and a message.
ArchiveException(ArchiveException priorException, String message, IOException cause)
          Constructs a new exception with the specified prior exception, a message and a cause.
 
Method Summary
 
Methods inherited from class de.schlichtherle.io.ChainableIOException
clone, getAppearance, getMaxPrintExceptions, getPrior, getPriority, initCause, initCause, printStackTrace, printStackTrace, printStackTrace, printStackTrace, setMaxPrintExceptions, sortAppearance, sortPriority
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArchiveException

public ArchiveException(ArchiveException priorException)
Constructs a new exception with the specified prior exception. This is used when e.g. updating all ZIP files and more than one ZIP compatible file cannot get updated. The prior exception would then be the exception for the ZIP compatible file which couldn't get updated before.

Parameters:
priorException - An exception that happened before and that was caught. This is not a cause! May be null.

ArchiveException

public ArchiveException(ArchiveException priorException,
                        String message)
Constructs a new exception with the specified prior exception and a message. This is used when e.g. updating all ZIP files and more than one ZIP compatible file cannot get updated. The prior exception would then be the exception for the ZIP compatible file which couldn't get updated before.

Parameters:
priorException - An exception that happened before and that was caught. This is not a cause! May be null.
message - The message for this exception.

ArchiveException

public ArchiveException(ArchiveException priorException,
                        IOException cause)
Constructs a new exception with the specified prior exception and the cause. This is used when e.g. updating all ZIP files and more than one ZIP compatible file cannot get updated. The prior exception would then be the exception for the ZIP compatible file which couldn't get updated before.

Parameters:
priorException - An exception that happened before and that was caught. This is not a cause! May be null.
cause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.).

ArchiveException

public ArchiveException(ArchiveException priorException,
                        String message,
                        IOException cause)
Constructs a new exception with the specified prior exception, a message and a cause. This is used when e.g. updating all ZIP files and more than one ZIP compatible file cannot get updated. The prior exception would then be the exception for the ZIP compatible file which couldn't get updated before.

Parameters:
priorException - An exception that happened before and that was caught. This is not a cause! May be null.
message - The message for this exception.
cause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.).