public class PowerManagerException
extends java.lang.RuntimeException
getErrCode can be
 used to retrieve the error that causes the exception.
 
 Error code ILLEGAL_STATE_TRANSITION_REQUEST,
 STATE_TRANSITION_FAILURE, must be used by the subclass of
 PowerManager to indicate power state related errors.
 
 Error code KEEP_CURRENT_STATE should be used by the
 EventListener when the listener wants to oppose the current state
 change event:
 
 
   public class MyApplication extends MIDlet implements EventListener {
       // ...
       void handleEvent(Event ev) {
          if((ev instanceof PowerStateEvent) &&
             // some condition that I do not like a certain change
             // of the power state right now
             // ... &&
             (!(((PowerStateEvent)ev).isUrgent()))) {
               throw new PowerStateException(
                          KEEP_CURRENT_STATE, "some objective");
          }
             
       }
       // ...
   }
 
  | 
 
| Modifier and Type | Field and Description | 
|---|---|
static byte | 
ILLEGAL_STATE_TRANSITION_REQUEST
An illegal transition requested. 
 | 
static byte | 
KEEP_CURRENT_STATE
Transition did not change states. 
 | 
static byte | 
STATE_TRANSITION_FAILURE
State transition failed. 
 | 
| Constructor and Description | 
|---|
PowerManagerException(byte err)
Constructs a  
PowerManagerException object with an error code. | 
PowerManagerException(byte err,
                     java.lang.String msg)
Constructs an  
PowerManagerException object with an error code
 and a detailed message. | 
| Modifier and Type | Method and Description | 
|---|---|
byte | 
getReason()
Gets the exception error code. 
 | 
public static final byte ILLEGAL_STATE_TRANSITION_REQUEST
public static final byte KEEP_CURRENT_STATE
public static final byte STATE_TRANSITION_FAILURE
public PowerManagerException(byte err)
PowerManagerException object with an error code.err - the error code that is used to create the exception object.
          MUST be one of ILLEGAL_STATE_TRANSITION_REQUEST,
          KEEP_CURRENT_STATE, or STATE_TRANSITION_FAILURE.java.lang.IllegalArgumentException - thrown for an unrecognized error code.public PowerManagerException(byte err,
                     java.lang.String msg)
PowerManagerException object with an error code
 and a detailed message.err - the error code that is used to create the exception object.
          MUST be one of ILLEGAL_STATE_TRANSITION_REQUEST,
          KEEP_CURRENT_STATE, or STATE_TRANSITION_FAILURE.msg - the detailed messagejava.lang.IllegalArgumentException - thrown for an unrecognized error code.public byte getReason()
ILLEGAL_STATE_TRANSITION_REQUEST,
          KEEP_CURRENT_STATE, or STATE_TRANSITION_FAILURE.Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.