harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r480208 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
Date Tue, 28 Nov 2006 21:02:40 GMT
Author: tellison
Date: Tue Nov 28 13:02:39 2006
New Revision: 480208

URL: http://svn.apache.org/viewvc?view=rev&rev=480208
Log:
Add check of return code from load library calls.

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp?view=diff&rev=480208&r1=480207&r2=480208
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
Tue Nov 28 13:02:39 2006
@@ -14,23 +14,38 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Pavel Dolgov
- * @version $Revision$
- */
 
-/* DO NOT EDIT THIS FILE - it is based on X11 headers and was autogenerated by nativebridge
tool */
+/* This file is based on X11 headers and was originally autogenerated by
+ * nativebridge tool.  It has since been modified by hand. */
 
 #include "org_apache_harmony_awt_nativebridge_linux_X11.h"
 #include "org_apache_harmony_awt_nativebridge_linux_ErrorHandler.h"
+#include "exceptions.h"
+
+#define LINK_EXCEPTION "java/lang/UnsatisfiedLinkError"
 
 static libHandler libX11;
 static libHandler libXmu;
 static libHandler libXtst;
 JNIEXPORT void JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_init (JNIEnv *
env, jclass cls) {
     LOAD_LIB(libX11, X11);
+    if (libX11 == NULL) {
+        throwNewExceptionByName(env, LINK_EXCEPTION, "Cannot load libX11.so library");
+        return;
+    }
+
     LOAD_LIB(libXmu, Xmu);
+    if (libXmu == NULL) {
+        throwNewExceptionByName(env, LINK_EXCEPTION, "Cannot load libXmu.so library");
+        return;
+    }
+
     LOAD_LIB(libXtst, Xtst);
+    if (libXtst == NULL) {
+        throwNewExceptionByName(env, LINK_EXCEPTION, "Cannot load libXtst.so library");
+        return;
+    }
+
     XInitThreads();
     XSetErrorHandler(errorHandler);
 }
@@ -1136,4 +1151,5 @@
     }
     return (jint) (* p_nbridge_XWithdrawWindow)((void *) param_0, (long) param_1, (int) param_2);
 }
+
 



Mime
View raw message