| 1 | /* |
| 2 | * $Id: COMException.java,v 1.1.1.5 2004/05/25 20:23:16 hastings Exp $ |
| 3 | * |
| 4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This material may be reproduced by or for the U. S. Government |
| 9 | * pursuant to the copyright license under the clause at |
| 10 | * DFARS 252.227-7014 (OCT 2001). |
| 11 | */ |
| 12 | |
| 13 | package com.moesol.bindings.platform_sdk.component_services; |
| 14 | |
| 15 | public class COMException extends RuntimeException { |
| 16 | public COMException(int hr) { |
| 17 | m_hr = hr; |
| 18 | } |
| 19 | public COMException(String msg, int hr) { |
| 20 | super(msg); |
| 21 | m_hr = hr; |
| 22 | } |
| 23 | public int getHRESULT() { |
| 24 | return m_hr; |
| 25 | } |
| 26 | public int getSCODE_CODE() { |
| 27 | return m_hr & 0xFFFF; |
| 28 | } |
| 29 | // Overridden to convert m_hr into an error message |
| 30 | public String getMessage() { |
| 31 | String r = super.getMessage(); |
| 32 | if (r != null) { return r; } |
| 33 | return jni_getMessage(m_hr); |
| 34 | } |
| 35 | |
| 36 | private native static String jni_getMessage(int hr); |
| 37 | private int m_hr = 0; |
| 38 | } |