Package com.ms.com |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public abstract class ComException extends RuntimeException { // Fields protected int hr; protected String m_source; protected String m_helpFile; protected int m_helpContext; // Constructors public ComException(int hr) public ComException(int hr, String description) public ComException(int hr, String source, String helpFile, int helpContext) public ComException(int hr, String description, String source, String helpFile, int helpContext) public ComException() public ComException(String description) // Methods public int getHResult() public String getSource() public String getHelpFile() public int getHelpContext() }
The ComException class wraps an HRESULT, the return type for most methods in the Component Object Module (COM). When calling COM methods from Java, you catch ComException objects to handle error conditions. Because ComException is derived from RuntimeException, the compiler does not check whether methods throw ComException objects or not. Use your discretion as to when you should use try-catch blocks.
When implementing COM classes using Java, ComException objects are thrown to signal error conditions. Because ComException is an abstract class, a ComException object cannot be constructed directly. However, a ComFailException object or a ComSuccessException object can be constructed.
public ComException(int hr)Stores a ComException.
Parameter Description hr The HRESULT value to be returned.
public ComException(int hr, String description)Stores a ComException.
Parameter Description hr The HRESULT value to be returned. description The detail description.
public ComException(int hr, String source, String helpFile, int helpContext)Stores a ComException.
Parameter Description hr The HRESULT value to be returned. source The source of the ComException. helpFile The help file for the ComException. helpContext The help context of the ComException.
public ComException(int hr, String description, String source, String helpFile, int helpContext)Stores a ComException.
Parameter Description hr The HRESULT value to be returned. description The detail description. source The source of the ComException. helpFile The help file for the ComException. helpContext The help context of the ComException.
public ComException()Stores a ComException.
public ComException(String description)Stores a ComException.
Parameter Description description The detail description.
public int getHResult()Retrieves the HRESULT returned by the COM method. Call this method when catching a ComException thrown by a COM method.
Return Value:
Returns the HRESULT returned by the COM method.
public String getSource()Retrieves the source of the ComException.
Return Value:
Returns the source of the ComException.
public String getHelpFile()Retrieves the help file for the ComException.
Return Value:
Returns the help file for the ComException.
public int getHelpContext()Retrieves the help context of the ComException.
Return Value:
Returns the help context of the ComException.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.