com.jniwrapper.win32.com
Class ComException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended bycom.jniwrapper.JNIWrapperException
                  extended bycom.jniwrapper.win32.com.ComException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AutomationException

public class ComException
extends JNIWrapperException

This exception class is used for indicating errors occurred on the COM side.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jniwrapper.JNIWrapperException
a, c
 
Constructor Summary
ComException(int hResult)
          Constructs a new instance with the passed error code.
ComException(int hResult, IErrorInfo errInfo)
          Constructs a new instance with the passed error code.
 
Method Summary
static void checkResult(HResult result)
          Utility method that verifies if the passed result code is less than zero.
static ComException createComException(java.lang.Throwable e, int hResult)
           
 IErrorInfo getErrorInfo()
           
 int getHResult()
           
 java.lang.String getHResultHex()
           
 
Methods inherited from class com.jniwrapper.JNIWrapperException
, a, createException, isThrowableConstructorAvailable, throwException
 
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
 

Constructor Detail

ComException

public ComException(int hResult)
Constructs a new instance with the passed error code.

Parameters:
hResult - error code

ComException

public ComException(int hResult,
                    IErrorInfo errInfo)
Constructs a new instance with the passed error code.

Parameters:
hResult - error code
errInfo - error info
Method Detail

getHResult

public int getHResult()
Returns:
the error code associated with the exception.

getErrorInfo

public IErrorInfo getErrorInfo()
Returns:
IErrorInfo, null if not available

getHResultHex

public java.lang.String getHResultHex()
Returns:
hexadecimal representation of the error code.

checkResult

public static void checkResult(HResult result)
                        throws ComException
Utility method that verifies if the passed result code is less than zero. If so, throws ComException with the value.

Parameters:
result - result code to check.
Throws:
ComException - if the result is less than zero.

createComException

public static ComException createComException(java.lang.Throwable e,
                                              int hResult)