Top Description Fields Constructors Methods
org.osgi.service.dal

public Class DeviceException

extends IOException
Class Inheritance
Imports
java.io.IOException

DeviceException is a special IOException, which is thrown to indicate that there is a device operation fail. The error reason can be located with getCode() method. The cause is available with getCause().

Field Summary

Modifier and TypeField and Description
private final int
public static final int
COMMUNICATION_ERROR

An exception code indicates that there is an error in the communication.

public static final int
NO_DATA

An exception code indicates that the requested value is currently not available.

public static final int
NOT_INITIALIZED

An exception code indicates that the device is not initialized.

private static final long
public static final int
TIMEOUT

An exception code indicates that there is expired timeout without any processing.

public static final int
UNKNOWN

An exception code indicates that the error is unknown.

Constructor Summary

AccessConstructor and Description
public
DeviceException()

Construct a new device exception with null message.

public
DeviceException(String
The exception message.
message
)

Constructs a new device exception with the given message.

public
DeviceException(String
The exception message.
message
,
Throwable
The exception cause.
cause
)

Constructs a new device exception with the given message and cause.

public
DeviceException(String
The exception message.
message
,
Throwable
The exception cause.
cause
,
int
The exception code.
code
)

Constructs a new device exception with the given message, cause and code.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

An exception code.
getCode
()

Returns the exception code.

Field Detail

codeback to summary
private final int code
COMMUNICATION_ERRORback to summary
public static final int COMMUNICATION_ERROR

An exception code indicates that there is an error in the communication.

NO_DATAback to summary
public static final int NO_DATA

An exception code indicates that the requested value is currently not available.

NOT_INITIALIZEDback to summary
public static final int NOT_INITIALIZED

An exception code indicates that the device is not initialized. The device status is Device#STATUS_NOT_INITIALIZED or Device#STATUS_PROCESSING.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.IOException.serialVersionUID.

TIMEOUTback to summary
public static final int TIMEOUT

An exception code indicates that there is expired timeout without any processing.

UNKNOWNback to summary
public static final int UNKNOWN

An exception code indicates that the error is unknown.

Constructor Detail

DeviceExceptionback to summary
public DeviceException()

Construct a new device exception with null message. The cause is not initialized and the exception code is set to UNKNOWN.

DeviceExceptionback to summary
public DeviceException(String message)

Constructs a new device exception with the given message. The cause is not initialized and the exception code is set to UNKNOWN.

Parameters
message:String

The exception message.

DeviceExceptionback to summary
public DeviceException(String message, Throwable cause)

Constructs a new device exception with the given message and cause. The exception code is set to UNKNOWN.

Parameters
message:String

The exception message.

cause:Throwable

The exception cause.

DeviceExceptionback to summary
public DeviceException(String message, Throwable cause, int code)

Constructs a new device exception with the given message, cause and code.

Parameters
message:String

The exception message.

cause:Throwable

The exception cause.

code:int

The exception code.

Method Detail

getCodeback to summary
public int getCode()

Returns the exception code. It indicates the reason for this exception. The code can be:

Zero and positive values are reserved for this definition and further extensions of the device exception codes. Custom codes can be used only as negative values to prevent potential collisions.
Returns:int

An exception code.