net.sf.sevenzipjbinding
Class SevenZipException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by net.sf.sevenzipjbinding.SevenZipException
All Implemented Interfaces:
java.io.Serializable

public class SevenZipException
extends java.io.IOException

SevenZip core exception. This exception supports multiple 'cause by' exceptions. Use printStackTraceExtended() to get stack traces of all available 'cause by's. Multiple 'cause by' can occur, if native code is involved. If in one of the call-back java methods an exception will be thrown, the native code will save this exception and may proceed with the next call-back java method, which can throw a further exception as well. After native code completes, a new SevenZipException will be thrown. This exception will have multiple 'cause by' exceptions attached:

If more, then two 'cause by' exception was thrown, only first and last exception will be saved.

In case of multi-threaded native code potential 'cause by' exception could be available in a SevenZipException. A potential 'cause by' exception situation can occur, if during a pending native call, a call-back java method will be called from a new thread. Since an exception thrown in another thread can't be always reliably connected to the operation proceeding (main native call), the exception will be saves as a potential first/last cause.

The methods provide full information about underlying 'cause by' exceptions and nested SevenZipException. In order to improve readability of the long extended stack traces, the origin of the current exception being printed can be read vertically on the left of the stack trace. The standard Throwable.printStackTrace() method prints only the stack trace of the first 'cause by' exception.

Since:
4.65-1
Author:
Boris Brodski
See Also:
printStackTraceExtended(), printStackTraceExtended(PrintStream), printStackTraceExtended(PrintWriter), Serialized Form

Constructor Summary
SevenZipException()
          Constructs a new exception with null as its detail message.
SevenZipException(java.lang.String message)
          Constructs a new exception with the specified detail message.
SevenZipException(java.lang.String message, java.lang.Throwable cause)
          Constructs a new exception with the specified detail message and cause.
SevenZipException(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).
 
Method Summary
 java.lang.Throwable getCause()
          Get first thrown exception as a cause for this exception.
 java.lang.Throwable getCauseFirstPotentialThrown()
          Get the first thrown exception that was the potential cause for this exception.
 java.lang.Throwable getCauseLastPotentialThrown()
          Get the last thrown exception that was the potential cause for this exception.
 java.lang.Throwable getCauseLastThrown()
          Get last thrown exception as a cause for this exception.
 java.lang.String getMessage()
          
 java.lang.String getSevenZipExceptionMessage()
          Get 7-Zip-JBinding exception original error message (without 'cause by' messages)
 void printStackTraceExtended()
          Prints stack traces of this SevenZipException and of the all thrown 'cause by' exceptions to the specified system error stream System.err.
 void printStackTraceExtended(java.io.PrintStream printStream)
          Prints stack trace of this SevenZipException and of the all thrown 'cause by' exceptions to the specified print stream.
 void printStackTraceExtended(java.io.PrintWriter printWriter)
          Prints stack trace of this SevenZipException and of the all thrown 'cause by' exceptions to the specified print writer.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SevenZipException

public SevenZipException()
Constructs a new exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(Throwable).


SevenZipException

public SevenZipException(java.lang.String message,
                         java.lang.Throwable cause)
Constructs a new exception with the specified detail message and cause.

Note that the detail message associated with cause is not automatically incorporated in this exception's detail message.

Parameters:
message - the detail message (which is saved for later retrieval by the getMessage() method).
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
Since:
1.4

SevenZipException

public SevenZipException(java.lang.String message)
Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(Throwable).

Parameters:
message - the detail message. The detail message is saved for later retrieval by the getMessage() method.

SevenZipException

public SevenZipException(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 (for example, PrivilegedActionException).

Parameters:
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
Since:
1.4
Method Detail

getMessage

public java.lang.String getMessage()

Overrides:
getMessage in class java.lang.Throwable

getSevenZipExceptionMessage

public java.lang.String getSevenZipExceptionMessage()
Get 7-Zip-JBinding exception original error message (without 'cause by' messages)

Returns:
original error message

printStackTraceExtended

public void printStackTraceExtended()
Prints stack traces of this SevenZipException and of the all thrown 'cause by' exceptions to the specified system error stream System.err.


printStackTraceExtended

public void printStackTraceExtended(java.io.PrintStream printStream)
Prints stack trace of this SevenZipException and of the all thrown 'cause by' exceptions to the specified print stream.

Parameters:
printStream - PrintStream to use for output

printStackTraceExtended

public void printStackTraceExtended(java.io.PrintWriter printWriter)
Prints stack trace of this SevenZipException and of the all thrown 'cause by' exceptions to the specified print writer.

Parameters:
printWriter - PrintWriter to use for output

getCause

public java.lang.Throwable getCause()
Get first thrown exception as a cause for this exception.

Overrides:
getCause in class java.lang.Throwable

getCauseLastThrown

public java.lang.Throwable getCauseLastThrown()
Get last thrown exception as a cause for this exception.

Returns:
null if no other (different to getCause()) exception known as a cause for this exception.

getCauseLastPotentialThrown

public java.lang.Throwable getCauseLastPotentialThrown()
Get the last thrown exception that was the potential cause for this exception. The potential cause is an exception thrown in another thread where it's not possible to determine whether the exception has caused the current exception or not.

Returns:
null if no such exception was thrown.

getCauseFirstPotentialThrown

public java.lang.Throwable getCauseFirstPotentialThrown()
Get the first thrown exception that was the potential cause for this exception. The potential cause is an exception thrown in another thread where it's not possible to determine whether the exception has caused the current exception or not.

Returns:
null if no such exception was thrown.