Package org.osgi.framework
Class BundleException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.osgi.framework.BundleException
- All Implemented Interfaces:
Serializable
A Framework exception used to indicate that a bundle lifecycle problem
occurred.
A BundleException
object is created by the Framework to denote an
exception condition in the lifecycle of a bundle. BundleException
s
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:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The bundle activator was in error.static final int
The install or update operation failed because another already installed bundle has the same symbolic name and version.static final int
The operation was invalid.static final int
The bundle manifest was in error.static final int
The bundle could not be resolved due to an error with the Bundle-NativeCode header.static final int
The framework received an error while reading the input stream for a bundle.static final int
A framework hook rejected the operation.static final int
The bundle was not resolved.static final int
The operation failed due to insufficient permissions.static final int
The start transient operation failed because the start level of the bundle is greater than the current framework start levelstatic final int
The operation failed to complete the requested lifecycle state change.static final int
No exception type is specified.static final int
The operation was unsupported. -
Constructor Summary
ConstructorDescriptionBundleException
(String msg) Creates aBundleException
with the specified message.BundleException
(String msg, int type) Creates aBundleException
with the specified message and type.BundleException
(String msg, int type, Throwable cause) Creates aBundleException
with the specified message, type and exception cause.BundleException
(String msg, Throwable cause) Creates aBundleException
with the specified message and exception cause. -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Returns the cause of this exception ornull
if no cause was set.Returns the cause of this exception ornull
if no cause was specified when this exception was created.int
getType()
Returns the type for this exception orUNSPECIFIED
if the type was unspecified or unknown.Initializes the cause of this exception to the specified value.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
UNSPECIFIED
public static final int UNSPECIFIEDNo exception type is specified.- Since:
- 1.5
- See Also:
-
UNSUPPORTED_OPERATION
public static final int UNSUPPORTED_OPERATIONThe operation was unsupported. This type can be used anywhere a BundleException can be thrown.- Since:
- 1.5
- See Also:
-
INVALID_OPERATION
public static final int INVALID_OPERATIONThe operation was invalid.- Since:
- 1.5
- See Also:
-
MANIFEST_ERROR
public static final int MANIFEST_ERRORThe bundle manifest was in error.- Since:
- 1.5
- See Also:
-
RESOLVE_ERROR
public static final int RESOLVE_ERRORThe bundle was not resolved.- Since:
- 1.5
- See Also:
-
ACTIVATOR_ERROR
public static final int ACTIVATOR_ERRORThe bundle activator was in error.- Since:
- 1.5
- See Also:
-
SECURITY_ERROR
public static final int SECURITY_ERRORThe operation failed due to insufficient permissions.- Since:
- 1.5
- See Also:
-
STATECHANGE_ERROR
public static final int STATECHANGE_ERRORThe operation failed to complete the requested lifecycle state change.- Since:
- 1.5
- See Also:
-
NATIVECODE_ERROR
public static final int NATIVECODE_ERRORThe bundle could not be resolved due to an error with the Bundle-NativeCode header.- Since:
- 1.5
- See Also:
-
DUPLICATE_BUNDLE_ERROR
public static final int DUPLICATE_BUNDLE_ERRORThe 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:
-
START_TRANSIENT_ERROR
public static final int START_TRANSIENT_ERRORThe start transient operation failed because the start level of the bundle is greater than the current framework start level- Since:
- 1.5
- See Also:
-
READ_ERROR
public static final int READ_ERRORThe framework received an error while reading the input stream for a bundle.- Since:
- 1.6
- See Also:
-
REJECTED_BY_HOOK
public static final int REJECTED_BY_HOOKA framework hook rejected the operation.- Since:
- 1.6
- See Also:
-
-
Constructor Details
-
BundleException
Creates aBundleException
with the specified message and exception cause.- Parameters:
msg
- The associated message.cause
- The cause of this exception.
-
BundleException
Creates aBundleException
with the specified message.- Parameters:
msg
- The message.
-
BundleException
Creates aBundleException
with 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
Creates aBundleException
with the specified message and type.- Parameters:
msg
- The message.type
- The type for this exception.- Since:
- 1.5
-
-
Method Details
-
getNestedException
Returns the cause of this exception ornull
if 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
Returns the cause of this exception ornull
if no cause was set. -
initCause
Initializes the cause of this exception to the specified value.- Overrides:
initCause
in classThrowable
- Parameters:
cause
- The cause of this exception.- Returns:
- This exception.
- Throws:
IllegalArgumentException
- If the specified cause is this exception.IllegalStateException
- If the cause of this exception has already been set.- Since:
- 1.3
-
getType
public int getType()Returns the type for this exception orUNSPECIFIED
if the type was unspecified or unknown.- Returns:
- The type of this exception.
- Since:
- 1.5
-