Top Description Fields Constructors Methods
org.osgi.framework

public Class BundleException

extends Exception
Class Inheritance

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. 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.

Author
$Id: a0d23c4cb73b0d6386bcd6b9eebed29fdd9a4deb $

Field Summary

Modifier and TypeField and Description
public static final int
ACTIVATOR_ERROR

The bundle activator was in 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.

public static final int
INVALID_OPERATION

The operation was invalid.

public static final int
MANIFEST_ERROR

The bundle manifest was in error.

public static final int
NATIVECODE_ERROR

The bundle could not be resolved due to an error with the Bundle-NativeCode header.

public static final int
READ_ERROR

The framework received an error while reading the input stream for a bundle.

public static final int
REJECTED_BY_HOOK

A framework hook rejected the operation.

public static final int
RESOLVE_ERROR

The bundle was not resolved.

public static final int
SECURITY_ERROR

The operation failed due to insufficient permissions.

pack-priv static final long
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

public static final int
STATECHANGE_ERROR

The operation failed to complete the requested lifecycle state change.

private final int
type

Type of bundle exception.

public static final int
UNSPECIFIED

No exception type is specified.

public static final int
UNSUPPORTED_OPERATION

The operation was unsupported.

Constructor Summary

AccessConstructor and Description
public
BundleException(String
The associated message.
msg
,
Throwable
The cause of this exception.
cause
)

Creates a BundleException with the specified message and exception cause.

public
BundleException(String
The message.
msg
)

Creates a BundleException with the specified message.

public
BundleException(String
The associated message.
msg
,
int
The type for this exception.
type
,
Throwable
The cause of this exception.
cause
)

Creates a BundleException with the specified message, type and exception cause.

public
BundleException(String
The message.
msg
,
int
The type for this exception.
type
)

Creates a BundleException with the specified message and type.

Method Summary

Modifier and TypeMethod and Description
public Throwable

Returns:

The cause of this exception or null if no cause was set.
getCause
()

Overrides java.lang.Throwable.getCause.

Returns the cause of this exception or null if no cause was set.

public Throwable

Returns:

The result of calling getCause().
getNestedException
()

Returns the cause of this exception or null if no cause was specified when this exception was created.

public int

Returns:

The type of this exception.
getType
()

Returns the type for this exception or UNSPECIFIED if the type was unspecified or unknown.

public Throwable

Returns:

This exception.
initCause
(Throwable
The cause of this exception.
cause
)

Overrides java.lang.Throwable.initCause.

Initializes the cause of this exception to the specified value.

Field Detail

ACTIVATOR_ERRORback to summary
public static final int ACTIVATOR_ERROR

The bundle activator was in error.

Since
1.5
DUPLICATE_BUNDLE_ERRORback to summary
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
INVALID_OPERATIONback to summary
public static final int INVALID_OPERATION

The operation was invalid.

Since
1.5
MANIFEST_ERRORback to summary
public static final int MANIFEST_ERROR

The bundle manifest was in error.

Since
1.5
NATIVECODE_ERRORback to summary
public static final int NATIVECODE_ERROR

The bundle could not be resolved due to an error with the Bundle-NativeCode header.

Since
1.5
READ_ERRORback to summary
public static final int READ_ERROR

The framework received an error while reading the input stream for a bundle.

Since
1.6
REJECTED_BY_HOOKback to summary
public static final int REJECTED_BY_HOOK

A framework hook rejected the operation.

Since
1.6
RESOLVE_ERRORback to summary
public static final int RESOLVE_ERROR

The bundle was not resolved.

Since
1.5
SECURITY_ERRORback to summary
public static final int SECURITY_ERROR

The operation failed due to insufficient permissions.

Since
1.5
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

START_TRANSIENT_ERRORback to summary
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
STATECHANGE_ERRORback to summary
public static final int STATECHANGE_ERROR

The operation failed to complete the requested lifecycle state change.

Since
1.5
typeback to summary
private final int type

Type of bundle exception.

Since
1.5
UNSPECIFIEDback to summary
public static final int UNSPECIFIED

No exception type is specified.

Since
1.5
UNSUPPORTED_OPERATIONback to summary
public static final int UNSUPPORTED_OPERATION

The operation was unsupported. This type can be used anywhere a BundleException can be thrown.

Since
1.5

Constructor Detail

BundleExceptionback to summary
public BundleException(String msg, Throwable cause)

Creates a BundleException with the specified message and exception cause.

Parameters
msg:String

The associated message.

cause:Throwable

The cause of this exception.

BundleExceptionback to summary
public BundleException(String msg)

Creates a BundleException with the specified message.

Parameters
msg:String

The message.

BundleExceptionback to summary
public BundleException(String msg, int type, Throwable cause)

Creates a BundleException with the specified message, type and exception cause.

Parameters
msg:String

The associated message.

type:int

The type for this exception.

cause:Throwable

The cause of this exception.

Since
1.5
BundleExceptionback to summary
public BundleException(String msg, int type)

Creates a BundleException with the specified message and type.

Parameters
msg:String

The message.

type:int

The type for this exception.

Since
1.5

Method Detail

getCauseback to summary
public Throwable getCause()

Overrides java.lang.Throwable.getCause.

Returns the cause of this exception or null if no cause was set.

Returns:Throwable

The cause of this exception or null if no cause was set.

Annotations
@Override
Since
1.3
getNestedExceptionback to summary
public Throwable getNestedException()

Returns the cause of this exception or null 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:Throwable

The result of calling getCause().

getTypeback to summary
public int getType()

Returns the type for this exception or UNSPECIFIED if the type was unspecified or unknown.

Returns:int

The type of this exception.

Since
1.5
initCauseback to summary
public Throwable initCause(Throwable cause)

Overrides java.lang.Throwable.initCause.

Initializes the cause of this exception to the specified value.

Parameters
cause:Throwable

The cause of this exception.

Returns:Throwable

This exception.

Annotations
@Override
Exceptions
IllegalArgumentException:
If the specified cause is this exception.
IllegalStateException:
If the cause of this exception has already been set.
Since
1.3