Package org.osgi.framework
Class BundleException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.osgi.framework.BundleException
-
- All Implemented Interfaces:
java.io.Serializable
public class BundleException extends java.lang.ExceptionA Framework exception used to indicate that a bundle lifecycle problem occurred.A
BundleExceptionobject is created by the Framework to denote an exception condition in the lifecycle of a bundle.BundleExceptions should not be created by bundle developers. A type code is used to identify the exception type for future extendability.OSGi Alliance reserves the right to extend the set of types.
This exception conforms to the general purpose exception chaining mechanism.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intACTIVATOR_ERRORThe bundle activator was in error.static intDUPLICATE_BUNDLE_ERRORThe install or update operation failed because another already installed bundle has the same symbolic name and version.static intINVALID_OPERATIONThe operation was invalid.static intMANIFEST_ERRORThe bundle manifest was in error.static intNATIVECODE_ERRORThe bundle could not be resolved due to an error with the Bundle-NativeCode header.static intREAD_ERRORThe framework received an error while reading the input stream for a bundle.static intREJECTED_BY_HOOKA framework hook rejected the operation.static intRESOLVE_ERRORThe bundle was not resolved.static intSECURITY_ERRORThe operation failed due to insufficient permissions.static intSTART_TRANSIENT_ERRORThe start transient operation failed because the start level of the bundle is greater than the current framework start levelstatic intSTATECHANGE_ERRORThe operation failed to complete the requested lifecycle state change.static intUNSPECIFIEDNo exception type is specified.static intUNSUPPORTED_OPERATIONThe operation was unsupported.
-
Constructor Summary
Constructors Constructor Description BundleException(java.lang.String msg)Creates aBundleExceptionwith the specified message.BundleException(java.lang.String msg, int type)Creates aBundleExceptionwith the specified message and type.BundleException(java.lang.String msg, int type, java.lang.Throwable cause)Creates aBundleExceptionwith the specified message, type and exception cause.BundleException(java.lang.String msg, java.lang.Throwable cause)Creates aBundleExceptionwith the specified message and exception cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ThrowablegetCause()Returns the cause of this exception ornullif no cause was set.java.lang.ThrowablegetNestedException()Returns the cause of this exception ornullif no cause was specified when this exception was created.intgetType()Returns the type for this exception orUNSPECIFIEDif the type was unspecified or unknown.java.lang.ThrowableinitCause(java.lang.Throwable cause)Initializes the cause of this exception to the specified value.
-
-
-
Field Detail
-
UNSPECIFIED
public static final int UNSPECIFIED
No exception type is specified.- Since:
- 1.5
- See Also:
- Constant Field Values
-
UNSUPPORTED_OPERATION
public static final int UNSUPPORTED_OPERATION
The operation was unsupported. This type can be used anywhere a BundleException can be thrown.- Since:
- 1.5
- See Also:
- Constant Field Values
-
INVALID_OPERATION
public static final int INVALID_OPERATION
The operation was invalid.- Since:
- 1.5
- See Also:
- Constant Field Values
-
MANIFEST_ERROR
public static final int MANIFEST_ERROR
The bundle manifest was in error.- Since:
- 1.5
- See Also:
- Constant Field Values
-
RESOLVE_ERROR
public static final int RESOLVE_ERROR
The bundle was not resolved.- Since:
- 1.5
- See Also:
- Constant Field Values
-
ACTIVATOR_ERROR
public static final int ACTIVATOR_ERROR
The bundle activator was in error.- Since:
- 1.5
- See Also:
- Constant Field Values
-
SECURITY_ERROR
public static final int SECURITY_ERROR
The operation failed due to insufficient permissions.- Since:
- 1.5
- See Also:
- Constant Field Values
-
STATECHANGE_ERROR
public static final int STATECHANGE_ERROR
The operation failed to complete the requested lifecycle state change.- Since:
- 1.5
- See Also:
- Constant Field Values
-
NATIVECODE_ERROR
public static final int NATIVECODE_ERROR
The bundle could not be resolved due to an error with the Bundle-NativeCode header.- Since:
- 1.5
- See Also:
- Constant Field Values
-
DUPLICATE_BUNDLE_ERROR
public static final int DUPLICATE_BUNDLE_ERROR
The install or update operation failed because another already installed bundle has the same symbolic name and version. This exception type will only occur if the framework is configured to only allow a single bundle to be installed for a given symbolic name and version.- Since:
- 1.5
- See Also:
Constants.FRAMEWORK_BSNVERSION, Constant Field Values
-
START_TRANSIENT_ERROR
public static final int START_TRANSIENT_ERROR
The start transient operation failed because the start level of the bundle is greater than the current framework start level- Since:
- 1.5
- See Also:
- Constant Field Values
-
READ_ERROR
public static final int READ_ERROR
The framework received an error while reading the input stream for a bundle.- Since:
- 1.6
- See Also:
- Constant Field Values
-
REJECTED_BY_HOOK
public static final int REJECTED_BY_HOOK
A framework hook rejected the operation.- Since:
- 1.6
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BundleException
public BundleException(java.lang.String msg, java.lang.Throwable cause)Creates aBundleExceptionwith the specified message and exception cause.- Parameters:
msg- The associated message.cause- The cause of this exception.
-
BundleException
public BundleException(java.lang.String msg)
Creates aBundleExceptionwith the specified message.- Parameters:
msg- The message.
-
BundleException
public BundleException(java.lang.String msg, int type, java.lang.Throwable cause)Creates aBundleExceptionwith the specified message, type and exception cause.- Parameters:
msg- The associated message.type- The type for this exception.cause- The cause of this exception.- Since:
- 1.5
-
BundleException
public BundleException(java.lang.String msg, int type)Creates aBundleExceptionwith the specified message and type.- Parameters:
msg- The message.type- The type for this exception.- Since:
- 1.5
-
-
Method Detail
-
getNestedException
public java.lang.Throwable getNestedException()
Returns the cause of this exception ornullif no cause was specified when this exception was created.This method predates the general purpose exception chaining mechanism. The
getCause()method is now the preferred means of obtaining this information.- Returns:
- The result of calling
getCause().
-
getCause
public java.lang.Throwable getCause()
Returns the cause of this exception ornullif no cause was set.- Overrides:
getCausein classjava.lang.Throwable- Returns:
- The cause of this exception or
nullif no cause was set. - Since:
- 1.3
-
initCause
public java.lang.Throwable initCause(java.lang.Throwable cause)
Initializes the cause of this exception to the specified value.- Overrides:
initCausein classjava.lang.Throwable- Parameters:
cause- The cause of this exception.- Returns:
- This exception.
- Throws:
java.lang.IllegalArgumentException- If the specified cause is this exception.java.lang.IllegalStateException- If the cause of this exception has already been set.- Since:
- 1.3
-
getType
public int getType()
Returns the type for this exception orUNSPECIFIEDif the type was unspecified or unknown.- Returns:
- The type of this exception.
- Since:
- 1.5
-
-