aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp')
-rw-r--r--src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp
new file mode 100644
index 0000000..115e6f0
--- /dev/null
+++ b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp
@@ -0,0 +1,90 @@
+#include "MsOutlookMAPIHResultException.h"
+
+void
+MsOutlookMAPIHResultException_throwNew
+ (JNIEnv *jniEnv, HRESULT hResult, LPCTSTR file, ULONG line)
+{
+ jclass clazz;
+
+ clazz
+ = jniEnv->FindClass(
+ "net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMAPIHResultException");
+ if (clazz)
+ {
+ LPCTSTR message;
+
+ switch (hResult)
+ {
+ case MAPI_E_LOGON_FAILED:
+ message = _T("MAPI_E_LOGON_FAILED");
+ break;
+ case MAPI_E_NO_ACCESS:
+ message = _T("MAPI_E_NO_ACCESS");
+ break;
+ case MAPI_E_NOT_ENOUGH_MEMORY:
+ message = _T("MAPI_E_NOT_ENOUGH_MEMORY");
+ break;
+ case MAPI_E_NOT_FOUND:
+ message = _T("MAPI_E_NOT_FOUND");
+ break;
+ case MAPI_E_NOT_INITIALIZED:
+ message = _T("MAPI_E_NOT_INITIALIZED");
+ break;
+ case MAPI_E_TIMEOUT:
+ message = _T("MAPI_E_TIMEOUT");
+ break;
+ case MAPI_E_UNKNOWN_ENTRYID:
+ message = _T("MAPI_E_UNKNOWN_ENTRYID");
+ break;
+ case MAPI_E_USER_CANCEL:
+ message = _T("MAPI_E_USER_CANCEL");
+ break;
+ case MAPI_W_ERRORS_RETURNED:
+ message = _T("MAPI_W_ERRORS_RETURNED");
+ break;
+ case S_OK:
+ message = _T("S_OK");
+ break;
+ default:
+ message = NULL;
+ break;
+ }
+
+ if (message)
+ {
+ jmethodID methodID;
+
+ methodID
+ = jniEnv->GetMethodID(
+ clazz,
+ "<init>",
+ "(JLjava/lang/String;)V");
+ if (methodID)
+ {
+ jobject t;
+
+ t = jniEnv->NewObject(clazz, methodID, hResult, message);
+ if (t)
+ jniEnv->Throw((jthrowable) t);
+ return;
+ }
+ }
+
+ {
+ jmethodID methodID;
+
+ methodID = jniEnv->GetMethodID(clazz, "<init>", "(J)V");
+ if (methodID)
+ {
+ jobject t;
+
+ t = jniEnv->NewObject(clazz, methodID, hResult);
+ if (t)
+ jniEnv->Throw((jthrowable) t);
+ return;
+ }
+ }
+
+ jniEnv->ThrowNew(clazz, message);
+ }
+}