Top Description Fields Constructors Methods
org.osgi.framework

public Class ServiceException

extends RuntimeException
Class Inheritance

A service exception used to indicate that a service problem occurred.

A ServiceException object is created by the Framework or service implementation to denote an exception condition in the service. A type code is used to identify the exception type for future extendability. Service implementations may also create subclasses of ServiceException. When subclassing, the subclass should set the type to SUBCLASSED to indicate that ServiceException has been subclassed.

This exception conforms to the general purpose exception chaining mechanism.

Author
$Id: 32a515460813c702b127f65dda91cd23781b2a98 $
Since
1.5

Field Summary

Modifier and TypeField and Description
public static final int
ASYNC_ERROR

An asynchronous operation was unable to obtain the service.

public static final int
FACTORY_ERROR

The service factory produced an invalid service object.

public static final int
FACTORY_EXCEPTION

The service factory threw an exception.

public static final int
FACTORY_RECURSION

The service factory resulted in a recursive call to itself for the requesting bundle.

public static final int
REMOTE

An error occurred invoking a remote service.

pack-priv static final long
public static final int
SUBCLASSED

The exception is a subclass of ServiceException.

private final int
type

Type of service exception.

public static final int
UNREGISTERED

The service has been unregistered.

public static final int
UNSPECIFIED

No exception type is unspecified.

Constructor Summary

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

Creates a ServiceException with the specified message and exception cause.

public
ServiceException(String
The message.
msg
)

Creates a ServiceException with the specified message.

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

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

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

Creates a ServiceException with the specified message and type.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The type of this exception.
getType
()

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

Field Detail

ASYNC_ERRORback to summary
public static final int ASYNC_ERROR

An asynchronous operation was unable to obtain the service.

Since
1.8
FACTORY_ERRORback to summary
public static final int FACTORY_ERROR

The service factory produced an invalid service object.

FACTORY_EXCEPTIONback to summary
public static final int FACTORY_EXCEPTION

The service factory threw an exception.

FACTORY_RECURSIONback to summary
public static final int FACTORY_RECURSION

The service factory resulted in a recursive call to itself for the requesting bundle.

Since
1.6
REMOTEback to summary
public static final int REMOTE

An error occurred invoking a remote service.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

SUBCLASSEDback to summary
public static final int SUBCLASSED

The exception is a subclass of ServiceException. The subclass should be examined for the type of the exception.

typeback to summary
private final int type

Type of service exception.

UNREGISTEREDback to summary
public static final int UNREGISTERED

The service has been unregistered.

UNSPECIFIEDback to summary
public static final int UNSPECIFIED

No exception type is unspecified.

Constructor Detail

ServiceExceptionback to summary
public ServiceException(String msg, Throwable cause)

Creates a ServiceException with the specified message and exception cause.

Parameters
msg:String

The associated message.

cause:Throwable

The cause of this exception.

ServiceExceptionback to summary
public ServiceException(String msg)

Creates a ServiceException with the specified message.

Parameters
msg:String

The message.

ServiceExceptionback to summary
public ServiceException(String msg, int type, Throwable cause)

Creates a ServiceException 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.

ServiceExceptionback to summary
public ServiceException(String msg, int type)

Creates a ServiceException with the specified message and type.

Parameters
msg:String

The message.

type:int

The type for this exception.

Method Detail

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.