Package net.sf.sevenzipjbinding
Class SevenZipException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
net.sf.sevenzipjbinding.SevenZipException
- All Implemented Interfaces:
Serializable
SevenZip core exception. This exception supports multiple 'caused by' exceptions. Use
In case of multi-threaded native code, a potential 'caused by' exception could be available in a SevenZipException. A potential 'caused by' exception situation can occur if, during a pending native call, a callback Java method is called from a new thread. Since an exception thrown in another thread can't always be reliably connected to the operation in progress (the main native call), the exception is saved as a potential first/last cause.
The methods provide full information about the underlying 'caused by' exceptions and nested
printStackTraceExtended() to get stack traces of all available causes. Multiple causes can occur,
if native code is involved. If an exception is thrown in one of the callback Java methods, the native code will
save this exception and may proceed with the next callback Java method, which can throw a further exception as well.
After the native code completes, a new SevenZipException will be thrown. This exception will have multiple 'caused by'
exceptions attached:
- the exception thrown from the first callback Java method (first 'caused by' exception)
- the exception thrown from the last callback Java method (last 'caused by' exception)
In case of multi-threaded native code, a potential 'caused by' exception could be available in a SevenZipException. A potential 'caused by' exception situation can occur if, during a pending native call, a callback Java method is called from a new thread. Since an exception thrown in another thread can't always be reliably connected to the operation in progress (the main native call), the exception is saved as a potential first/last cause.
The methods provide full information about the underlying 'caused 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 'caused by' exception.- Since:
- 4.65-1
- Author:
- Boris Brodski
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new exception withnullas its detail message.SevenZipException(String message) Constructs a new exception with the specified detail message.SevenZipException(String message, Throwable cause) Constructs a new exception with the specified detail message and cause.SevenZipException(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 ofcause). -
Method Summary
Modifier and TypeMethodDescriptiongetCause()Get first thrown exception as a cause for this exception.Get the first thrown exception that was the potential cause for this exception.Get the last thrown exception that was the potential cause for this exception.Get last thrown exception as a cause for this exception.Get the original 7-Zip-JBinding exception error message (without the 'caused by' messages)voidPrints stack traces of this SevenZipException and of all thrown 'caused by' exceptions to the specified system error streamSystem.err.voidprintStackTraceExtended(PrintStream printStream) Prints stack trace of this SevenZipException and of all thrown 'caused by' exceptions to the specified print stream.voidprintStackTraceExtended(PrintWriter printWriter) Prints stack trace of this SevenZipException and of all thrown 'caused by' exceptions to the specified print writer.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
SevenZipException
public SevenZipException()Constructs a new exception withnullas its detail message. The cause is not initialized, and may subsequently be initialized by a call toThrowable.initCause(Throwable). -
SevenZipException
Constructs a new exception with the specified detail message and cause.Note that the detail message associated with
causeis not automatically incorporated in this exception's detail message.- Parameters:
message- the detail message (which is saved for later retrieval by thegetMessage()method).cause- the cause (which is saved for later retrieval by thegetCause()method). (Anullvalue is permitted, and indicates that the cause is nonexistent or unknown.)- Since:
- 4.65-1
-
SevenZipException
Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call toThrowable.initCause(Throwable).- Parameters:
message- the detail message. The detail message is saved for later retrieval by thegetMessage()method.
-
SevenZipException
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 ofcause). 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 thegetCause()method). (Anullvalue is permitted, and indicates that the cause is nonexistent or unknown.)- Since:
- 4.65-1
-
-
Method Details
-
getMessage
- Overrides:
getMessagein classThrowable
-
getSevenZipExceptionMessage
Get the original 7-Zip-JBinding exception error message (without the 'caused by' messages)- Returns:
- original error message
-
printStackTraceExtended
public void printStackTraceExtended()Prints stack traces of this SevenZipException and of all thrown 'caused by' exceptions to the specified system error streamSystem.err. -
printStackTraceExtended
Prints stack trace of this SevenZipException and of all thrown 'caused by' exceptions to the specified print stream.- Parameters:
printStream-PrintStreamto use for output
-
printStackTraceExtended
Prints stack trace of this SevenZipException and of all thrown 'caused by' exceptions to the specified print writer.- Parameters:
printWriter-PrintWriterto use for output
-
getCause
Get first thrown exception as a cause for this exception. -
getCauseLastThrown
Get last thrown exception as a cause for this exception.- Returns:
nullif no other (different togetCause()) exception known as a cause for this exception.
-
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:
nullif no such exception was thrown.
-
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:
nullif no such exception was thrown.
-