OSGi™ Core
Release 6

org.osgi.framework
Class ServiceException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.osgi.framework.ServiceException
All Implemented Interfaces:
Serializable

public class ServiceException
extends RuntimeException

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.

Since:
1.5
See Also:
Serialized Form

Field Summary
static int ASYNC_ERROR
          An asynchronous operation was unable to obtain the service.
static int FACTORY_ERROR
          The service factory produced an invalid service object.
static int FACTORY_EXCEPTION
          The service factory threw an exception.
static int FACTORY_RECURSION
          The service factory resulted in a recursive call to itself for the requesting bundle.
static int REMOTE
          An error occurred invoking a remote service.
static int SUBCLASSED
          The exception is a subclass of ServiceException.
static int UNREGISTERED
          The service has been unregistered.
static int UNSPECIFIED
          No exception type is unspecified.
 
Constructor Summary
ServiceException(String msg)
          Creates a ServiceException with the specified message.
ServiceException(String msg, int type)
          Creates a ServiceException with the specified message and type.
ServiceException(String msg, int type, Throwable cause)
          Creates a ServiceException with the specified message, type and exception cause.
ServiceException(String msg, Throwable cause)
          Creates a ServiceException with the specified message and exception cause.
 
Method Summary
 int getType()
          Returns the type for this exception or UNSPECIFIED if the type was unspecified or unknown.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNSPECIFIED

public static final int UNSPECIFIED
No exception type is unspecified.

See Also:
Constant Field Values

UNREGISTERED

public static final int UNREGISTERED
The service has been unregistered.

See Also:
Constant Field Values

FACTORY_ERROR

public static final int FACTORY_ERROR
The service factory produced an invalid service object.

See Also:
Constant Field Values

FACTORY_EXCEPTION

public static final int FACTORY_EXCEPTION
The service factory threw an exception.

See Also:
Constant Field Values

SUBCLASSED

public static final int SUBCLASSED
The exception is a subclass of ServiceException. The subclass should be examined for the type of the exception.

See Also:
Constant Field Values

REMOTE

public static final int REMOTE
An error occurred invoking a remote service.

See Also:
Constant Field Values

FACTORY_RECURSION

public static final int FACTORY_RECURSION
The service factory resulted in a recursive call to itself for the requesting bundle.

Since:
1.6
See Also:
Constant Field Values

ASYNC_ERROR

public static final int ASYNC_ERROR
An asynchronous operation was unable to obtain the service.

Since:
1.8
See Also:
Constant Field Values
Constructor Detail

ServiceException

public ServiceException(String msg,
                        Throwable cause)
Creates a ServiceException with the specified message and exception cause.

Parameters:
msg - The associated message.
cause - The cause of this exception.

ServiceException

public ServiceException(String msg)
Creates a ServiceException with the specified message.

Parameters:
msg - The message.

ServiceException

public ServiceException(String msg,
                        int type,
                        Throwable cause)
Creates a ServiceException 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.

ServiceException

public ServiceException(String msg,
                        int type)
Creates a ServiceException with the specified message and type.

Parameters:
msg - The message.
type - The type for this exception.
Method Detail

getType

public int getType()
Returns the type for this exception or UNSPECIFIED if the type was unspecified or unknown.

Returns:
The type of this exception.

OSGi™ Core
Release 6

Copyright © OSGi Alliance (2000, 2015). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0