Package org.osgi.service.dal
Class DeviceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- org.osgi.service.dal.DeviceException
-
- All Implemented Interfaces:
java.io.Serializable
public class DeviceException extends java.io.IOException
DeviceException
is a specialIOException
, which is thrown to indicate that there is a device operation fail. The error reason can be located withgetCode()
method. The cause is available withThrowable.getCause()
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMMUNICATION_ERROR
An exception code indicates that there is an error in the communication.static int
NO_DATA
An exception code indicates that the requested value is currently not available.static int
NOT_INITIALIZED
An exception code indicates that the device is not initialized.static int
TIMEOUT
An exception code indicates that there is expired timeout without any processing.static int
UNKNOWN
An exception code indicates that the error is unknown.
-
Constructor Summary
Constructors Constructor Description DeviceException()
Construct a new device exception withnull
message.DeviceException(java.lang.String message)
Constructs a new device exception with the given message.DeviceException(java.lang.String message, java.lang.Throwable cause)
Constructs a new device exception with the given message and cause.DeviceException(java.lang.String message, java.lang.Throwable cause, int code)
Constructs a new device exception with the given message, cause and code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCode()
Returns the exception code.
-
-
-
Field Detail
-
UNKNOWN
public static final int UNKNOWN
An exception code indicates that the error is unknown.- See Also:
- Constant Field Values
-
COMMUNICATION_ERROR
public static final int COMMUNICATION_ERROR
An exception code indicates that there is an error in the communication.- See Also:
- Constant Field Values
-
TIMEOUT
public static final int TIMEOUT
An exception code indicates that there is expired timeout without any processing.- See Also:
- Constant Field Values
-
NOT_INITIALIZED
public static final int NOT_INITIALIZED
An exception code indicates that the device is not initialized. The device status isDevice.STATUS_NOT_INITIALIZED
orDevice.STATUS_PROCESSING
.- See Also:
- Constant Field Values
-
NO_DATA
public static final int NO_DATA
An exception code indicates that the requested value is currently not available.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeviceException
public DeviceException()
Construct a new device exception withnull
message. The cause is not initialized and the exception code is set toUNKNOWN
.
-
DeviceException
public DeviceException(java.lang.String message)
Constructs a new device exception with the given message. The cause is not initialized and the exception code is set toUNKNOWN
.- Parameters:
message
- The exception message.
-
DeviceException
public DeviceException(java.lang.String message, java.lang.Throwable cause)
Constructs a new device exception with the given message and cause. The exception code is set toUNKNOWN
.- Parameters:
message
- The exception message.cause
- The exception cause.
-
DeviceException
public DeviceException(java.lang.String message, java.lang.Throwable cause, int code)
Constructs a new device exception with the given message, cause and code.- Parameters:
message
- The exception message.cause
- The exception cause.code
- The exception code.
-
-
Method Detail
-
getCode
public int getCode()
Returns the exception code. It indicates the reason for this exception. The code can be:UNKNOWN
COMMUNICATION_ERROR
TIMEOUT
NOT_INITIALIZED
NO_DATA
- custom code
- Returns:
- An exception code.
-
-