You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2008/06/05 12:30:54 UTC

svn commit: r663517 - /harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c

Author: hindessm
Date: Thu Jun  5 03:30:54 2008
New Revision: 663517

URL: http://svn.apache.org/viewvc?rev=663517&view=rev
Log:
Throw exception in the event of a failure since the java code doesn't (at
least not immediately) check the return value.

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c?rev=663517&r1=663516&r2=663517&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c Thu Jun  5 03:30:54 2008
@@ -17,6 +17,7 @@
 
 #include "vmi.h"
 #include "zconf.h"
+#include "exceptions.h"
 
 uLong crc32 PROTOTYPE ((uLong crc, const Bytef * buf, uInt size));
 
@@ -29,8 +30,10 @@
   jlong result;
 
   b = ((*env)->GetPrimitiveArrayCritical (env, buf, 0));
-  if (b == NULL)
+  if (b == NULL) {
+    throwNewOutOfMemoryError(env, "");
     return -1;
+  }
   result = crc32 ((uLong) crc, (Bytef *) (b + off), (uInt) len);
   ((*env)->ReleasePrimitiveArrayCritical (env, buf, b, JNI_ABORT));
   return result;