commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r790132 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr_private.h shared/object.c
Date Wed, 01 Jul 2009 11:58:38 GMT
Author: mturk
Date: Wed Jul  1 11:58:37 2009
New Revision: 790132

URL: http://svn.apache.org/viewvc?rev=790132&view=rev
Log:
Check for object null before the call

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
    commons/sandbox/runtime/trunk/src/main/native/shared/object.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h?rev=790132&r1=790131&r2=790132&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h Wed Jul  1 11:58:37
2009
@@ -457,17 +457,22 @@
 
 #endif /* CC_SIZEOF_VOIDP == 8 */
 
-#define CALL_METHOD1(I, O, V)  \
+#define CALL_VMETHOD0(I, O)  \
+    if (_m##I##n.i) {                                                       \
+        (*_E)->CallVoidMethod(_E, (O), _m##I##n.i);                         \
+    } else (void)(0)
+
+#define CALL_VMETHOD1(I, O, V)  \
     if (_m##I##n.i) {                                                       \
         (*_E)->CallVoidMethod(_E, (O), _m##I##n.i, (V));                    \
     } else (void)(0)
 
-#define CALL_METHOD2(I, O, V, X)  \
+#define CALL_VMETHOD2(I, O, V, X)  \
     if (_m##I##n.i) {                                                       \
         (*_E)->CallVoidMethod(_E, (O), _m##I##n.i, (V), (X));               \
     } else (void)(0)
 
-#define CALL_METHOD3(I, O, V, X, Y)  \
+#define CALL_VMETHOD3(I, O, V, X, Y)  \
     if (_m##I##n.i) {                                                       \
         (*_E)->CallVoidMethod(_E, (O), _m##I##n.i, (V), (X), (Y));          \
     } else (void)(0)
@@ -475,8 +480,8 @@
 #define CALL_METHOD0(T, I, O)  \
         (*_E)->Call##T##Method(_E, (O), _m##I##n.i)
 
-#define CALL_METHODN(T, I, O, ARGS)  \
-        (*_E)->Call##T##Method(_E, (O), _m##I##n.i, ARGS)
+#define CALL_METHOD1(T, I, O, V)  \
+        (*_E)->Call##T##Method(_E, (O), _m##I##n.i, (V))
 
 #define SET_SARRAY_A(A, I, V)                               \
     if ((A) && (V)) {                                       \

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/object.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/object.c?rev=790132&r1=790131&r2=790132&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/object.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/object.c Wed Jul  1 11:58:37 2009
@@ -96,8 +96,10 @@
 {
     int rc = ACR_ECLASSNOTFOUND;
 
+    if (IS_JOBJECT_NULL(_E, _O))
+        return ACR_EINVAL;
     if (_clazzn.i && J4MID(0000)) {
-        CALL_METHOD0(Void, 0001, _O);
+        CALL_VMETHOD0(0001, _O);
         if ((*_E)->ExceptionCheck(_E)) {
             (*_E)->ExceptionClear(_E);
             rc = ACR_EBUSY;
@@ -112,8 +114,10 @@
 {
     int rc = ACR_ECLASSNOTFOUND;
 
+    if (IS_JOBJECT_NULL(_E, _O))
+        return ACR_EINVAL;
     if (_clazzn.i && J4MID(0000)) {
-        CALL_METHOD0(Void, 0002, _O);
+        CALL_VMETHOD0(0002, _O);
         if ((*_E)->ExceptionCheck(_E)) {
             (*_E)->ExceptionClear(_E);
             rc = ACR_EBUSY;
@@ -128,8 +132,10 @@
 {
     int rc = ACR_ECLASSNOTFOUND;
 
+    if (IS_JOBJECT_NULL(_E, _O))
+        return ACR_EINVAL;
     if (_clazzn.i && J4MID(0000)) {
-        CALL_METHOD0(Void, 0005, _O);
+        CALL_VMETHOD0(0005, _O);
         if ((*_E)->ExceptionCheck(_E)) {
             (*_E)->ExceptionClear(_E);
             rc = ACR_TIMEUP;
@@ -144,8 +150,10 @@
 {
     int rc = ACR_ECLASSNOTFOUND;
 
+    if (IS_JOBJECT_NULL(_E, _O))
+        return ACR_EINVAL;
     if (_clazzn.i && J4MID(0000)) {
-        CALL_METHOD1(0003, _O, ms);
+        CALL_VMETHOD1(0003, _O, ms);
         if ((*_E)->ExceptionCheck(_E)) {
             (*_E)->ExceptionClear(_E);
             rc = ACR_TIMEUP;
@@ -160,8 +168,10 @@
 {
     int rc = ACR_ECLASSNOTFOUND;
 
+    if (IS_JOBJECT_NULL(_E, _O))
+        return ACR_EINVAL;
     if (_clazzn.i && J4MID(0000)) {
-        CALL_METHOD2(0004, _O, ms, ns);
+        CALL_VMETHOD2(0004, _O, ms, ns);
         if ((*_E)->ExceptionCheck(_E)) {
             (*_E)->ExceptionClear(_E);
             rc = ACR_TIMEUP;
@@ -174,8 +184,10 @@
 
 ACR_DECLARE(void) ACR_ObjectFinalize(ACR_JNISTDARGS)
 {
+    if (IS_JOBJECT_NULL(_E, _O))
+        return;
     if (_clazzn.i && J4MID(0000)) {
-        CALL_METHOD0(Void, 0006, _O);
+        CALL_VMETHOD0(0006, _O);
     }
 }
 



Mime
View raw message