harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r423950 - in /incubator/harmony/enhanced/classlib/trunk/modules: archive/src/main/native/archive/shared/ luni/src/main/native/include/linux/ luni/src/main/native/include/windows/ luni/src/main/native/luni/linux/ luni/src/main/native/luni/sh...
Date Thu, 20 Jul 2006 15:00:54 GMT
Author: hindessm
Date: Thu Jul 20 08:00:53 2006
New Revision: 423950

URL: http://svn.apache.org/viewvc?rev=423950&view=rev
Log:
Refactor some more bits of exception throwing code.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/linux/jclprots.h
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/windows/jclprots.h
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/shared/BidiWrapper.c

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
Thu Jul 20 08:00:53 2006
@@ -21,7 +21,7 @@
 
 #include "inflater.h"
 
-void throwNewDataFormatException (JNIEnv * env, char *message);
+void throwNewDataFormatException (JNIEnv * env, const char *message);
 
 /* Create a new stream . This stream cannot be used until it has been properly initialized.
*/
 jlong JNICALL
@@ -237,14 +237,9 @@
   * Throw java.util.zip.DataFormatException
   */
 void
-throwNewDataFormatException (JNIEnv * env, char *message)
+throwNewDataFormatException (JNIEnv * env, const char *message)
 {
-  jclass exceptionClass = (*env)->FindClass(env, "java/util/zip/DataFormatException");
-  if (0 == exceptionClass) { 
-    /* Just return if we can't load the exception class. */
-    return;
-    }
-  (*env)->ThrowNew(env, exceptionClass, message);
+  throwNewExceptionByName(env, "java/util/zip/DataFormatException", message);
 }
 
 jlong JNICALL

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
Thu Jul 20 08:00:53 2006
@@ -26,30 +26,18 @@
   * Throw java.lang.InternalError
   */
 void
-throwNewInternalError (JNIEnv * env, char *message)
+throwNewInternalError (JNIEnv * env, const char *message)
 {
-  jclass exceptionClass = (*env)->FindClass(env, "java/lang/InternalError");
-  if (0 == exceptionClass)
-    {
-    /* Just return if we can't load the exception class. */
-    return;
-    }
-  (*env)->ThrowNew(env, exceptionClass, message);
+  throwNewExceptionByName(env, "java/lang/InternalError", message);
 }
 
 /**
   * Throw java.util.zip.ZipException with the message provided
   */
 void
-throwJavaZIOException (JNIEnv * env, char *message)
+throwJavaZIOException (JNIEnv * env, const char *message)
 {
-  jclass exceptionClass = (*env)->FindClass(env, "java/util/zip/ZipException");
-  if (0 == exceptionClass)
-    { 
-    /* Just return if we can't load the exception class. */
-    return;
-    }
-  (*env)->ThrowNew(env, exceptionClass, message);
+  throwNewExceptionByName(env, "java/util/zip/ZipException", message);
 }
 
 jint JNICALL
@@ -216,30 +204,18 @@
   * Throw java.lang.IllegalStateException
   */
 void
-throwNewIllegalStateException (JNIEnv * env, char *message)
+throwNewIllegalStateException (JNIEnv * env, const char *message)
 {
-  jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalStateException");
-  if (0 == exceptionClass)
-    {
-    /* Just return if we can't load the exception class. */
-    return;
-    }
-  (*env)->ThrowNew(env, exceptionClass, message);
+  throwNewExceptionByName(env, "java/lang/IllegalStateException", message);
 }
 
 /**
   * Throw java.lang.IllegalArgumentException
   */
 void
-throwNewIllegalArgumentException (JNIEnv * env, char *message)
+throwNewIllegalArgumentException (JNIEnv * env, const char *message)
 {
-  jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
-  if (0 == exceptionClass)
-    {
-    /* Just return if we can't load the exception class. */
-    return;
-    }
-  (*env)->ThrowNew(env, exceptionClass, message);
+  throwNewExceptionByName(env, "java/lang/IllegalArgumentException", message);
 }
 
 void JNICALL

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/linux/jclprots.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/linux/jclprots.h?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/linux/jclprots.h
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/linux/jclprots.h
Thu Jul 20 08:00:53 2006
@@ -275,17 +275,17 @@
 	JNIEnv* env, jclass thisClz, jobject thisObjFD, jboolean preferIPv4Stack));
 
 /* NativesCommonZipFile*/
-void throwJavaZIOException PROTOTYPE((JNIEnv * env, char *message));
-void throwNewInternalError PROTOTYPE((JNIEnv * env, char * message));
+void throwJavaZIOException PROTOTYPE((JNIEnv * env, const char *message));
+void throwNewInternalError PROTOTYPE((JNIEnv * env, const char * message));
 void JNICALL Java_java_util_zip_ZipFile_closeZipImpl PROTOTYPE((JNIEnv * env, jobject recv));
 jobject JNICALL Java_java_util_zip_ZipFile_00024ZFEnum_getNextEntry PROTOTYPE((JNIEnv * env,
jobject recv, jlong descriptor, jlong nextEntry));
 void JNICALL Java_java_util_zip_ZipFile_ntvinit PROTOTYPE((JNIEnv * env, jclass cls));
-void throwNewIllegalStateException PROTOTYPE((JNIEnv * env, char * message));
+void throwNewIllegalStateException PROTOTYPE((JNIEnv * env, const char * message));
 jlong JNICALL Java_java_util_zip_ZipFile_00024ZFEnum_resetZip PROTOTYPE((JNIEnv * env, jobject
recv, jlong descriptor));
 jint JNICALL Java_java_util_zip_ZipFile_openZipImpl PROTOTYPE((JNIEnv * env, jobject recv,
jbyteArray zipName));
 jobject JNICALL Java_java_util_zip_ZipFile_getEntryImpl PROTOTYPE((JNIEnv * env, jobject
recv, jlong zipPointer, jstring entryName));
 jbyteArray JNICALL Java_java_util_zip_ZipFile_inflateEntryImpl2 PROTOTYPE((JNIEnv * env,
jobject recv, jlong zipPointer, jstring entryName));
-void throwNewIllegalArgumentException PROTOTYPE((JNIEnv * env, char * message));
+void throwNewIllegalArgumentException PROTOTYPE((JNIEnv * env, const char * message));
 
 /* NativesCommonInetAddress*/
 void JNICALL Java_java_net_InetAddress_oneTimeInitialization PROTOTYPE((JNIEnv * env, jclass
clazz, jboolean ipv6_support ));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/windows/jclprots.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/windows/jclprots.h?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/windows/jclprots.h
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/windows/jclprots.h
Thu Jul 20 08:00:53 2006
@@ -483,8 +483,8 @@
                 jboolean preferIPv4Stack));
                 
   /* NativesCommonZipFile*/
-  void throwJavaZIOException PROTOTYPE ((JNIEnv * env, char *message));
-  void throwNewInternalError PROTOTYPE ((JNIEnv * env, char *message));
+  void throwJavaZIOException PROTOTYPE ((JNIEnv * env, const char *message));
+  void throwNewInternalError PROTOTYPE ((JNIEnv * env, const char *message));
   void JNICALL Java_java_util_zip_ZipFile_closeZipImpl
     PROTOTYPE ((JNIEnv * env, jobject recv));
   jobject JNICALL Java_java_util_zip_ZipFile_00024ZFEnum_getNextEntry
@@ -493,7 +493,7 @@
   void JNICALL Java_java_util_zip_ZipFile_ntvinit
     PROTOTYPE ((JNIEnv * env, jclass cls));
   void throwNewIllegalStateException
-    PROTOTYPE ((JNIEnv * env, char *message));
+    PROTOTYPE ((JNIEnv * env, const char *message));
   jlong JNICALL Java_java_util_zip_ZipFile_00024ZFEnum_resetZip
     PROTOTYPE ((JNIEnv * env, jobject recv, jlong descriptor));
   jint JNICALL Java_java_util_zip_ZipFile_openZipImpl
@@ -505,7 +505,7 @@
     PROTOTYPE ((JNIEnv * env, jobject recv, jlong zipPointer,
                 jstring entryName));
   void throwNewIllegalArgumentException
-    PROTOTYPE ((JNIEnv * env, char *message));
+    PROTOTYPE ((JNIEnv * env, const char *message));
     
   /* NativesCommonInetAddress*/
   void JNICALL Java_java_net_InetAddress_oneTimeInitialization

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSMemory.c
Thu Jul 20 08:00:53 2006
@@ -28,14 +28,12 @@
 {
   PORT_ACCESS_FROM_ENV (env);
 
-  jclass exceptionClazz;
   void *address = hymem_allocate_memory ((UDATA) size);
 
   if (address == NULL)
     {
-      exceptionClazz = (*env)->FindClass (env, "java/lang/OutOfMemoryError");
-      (*env)->ThrowNew (env, exceptionClazz,
-			"Insufficient memory available.");
+      throwNewOutOfMemoryError(env, "java/lang/OutOfMemoryError",
+                               "Insufficient memory available.");
     }
 
   return (jlong) ((IDATA) address);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
Thu Jul 20 08:00:53 2006
@@ -18,6 +18,7 @@
 #include "vmi.h"
 #include "cbigint.h"
 #include "jclglob.h"
+#include "exceptions.h"
 
 #if defined(LINUX)
 #define USE_LL
@@ -637,17 +638,11 @@
     }
   else if (LOW_I32_FROM_VAR (dbl) == (I_32) - 1)
     {                           /* NumberFormatException */
-      clazz = (*env)->FindClass (env, "java/lang/NumberFormatException");
-      if (clazz == 0)
-        return 0.0;
-      (*env)->ThrowNew (env, clazz, "");
+      throwNewExceptionByName(env, "java/lang/NumberFormatException", "");
     }
   else
     {                           /* OutOfMemoryError */
-      clazz = (*env)->FindClass (env, "java/lang/OutOfMemoryError");
-      if (clazz == 0)
-        return 0.0;
-      (*env)->ThrowNew (env, clazz, "");
+      throwNewOutOfMemoryError(env, "");
     }
 
   return 0.0;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c
Thu Jul 20 08:00:53 2006
@@ -49,12 +49,8 @@
   if (syncfailed)
     {
       /* Find and throw SyncFailedException */
-      jclass exceptionClass = (*env)->FindClass(env, "java/io/SyncFailedException");
-      if (0 == exceptionClass) { 
-        /* Just return if we can't load the exception class. */
-        return;
-        }
-      (*env)->ThrowNew(env, exceptionClass, "Failed to Sync File");
+      throwNewExceptionByName(env, "java/io/SyncFailedException",
+                              "Failed to Sync File");
       return;
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
Thu Jul 20 08:00:53 2006
@@ -18,6 +18,7 @@
 #include "vmi.h"
 #include "cbigint.h"
 #include "jclglob.h"
+#include "exceptions.h"
 
 #if defined(LINUX)
 #define USE_LL
@@ -540,17 +541,11 @@
     }
   else if (((I_32) FLOAT_TO_INTBITS (flt)) == (I_32) - 1)
     {
-      clazz = (*env)->FindClass (env, "java/lang/NumberFormatException");
-      if (clazz == 0)
-        return 0.0;
-      (*env)->ThrowNew (env, clazz, "");
+      throwNewExceptionByName(env, "java/lang/NumberFormatException", "");
     }
   else
     {                           /* OutOfMemoryError */
-      clazz = (*env)->FindClass (env, "java/lang/OutOfMemoryError");
-      if (clazz == 0)
-        return 0.0;
-      (*env)->ThrowNew (env, clazz, "");
+      throwNewOutOfMemoryError(env, "");
     }
 
   return 0.0;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
Thu Jul 20 08:00:53 2006
@@ -17,6 +17,7 @@
 #include "hysock.h"
 #include "hyport.h"
 #include "jclglob.h"
+#include "exceptions.h"
 
 /**
  * Set up JNI ID Caches.
@@ -271,17 +272,12 @@
 void
 throwJavaLangIllegalArgumentException (JNIEnv * env, I_32 errorNumber)
 {
-  jclass aClass;
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   char *errorMessage = netLookupErrorString (env, errorNumber);
-  aClass = (*env)->FindClass (env, "java/lang/IllegalArgumentException");
-  if (0 == aClass)
-    {
-      return;
-    }
-  (*env)->ThrowNew (env, aClass, errorMessage);
-
+  throwNewExceptionByName(env, "java/lang/IllegalArgumentException",
+                          errorMessage);
 }
 
 /**
@@ -296,8 +292,9 @@
 throwJavaNetBindException (JNIEnv * env, I_32 errorNumber)
 {
   jclass aClass;
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   char *errorMessage = netLookupErrorString (env, errorNumber);
   aClass = (*env)->FindClass (env, "java/net/BindException");
   if (0 == aClass)
@@ -351,17 +348,11 @@
 void
 throwJavaNetSocketException (JNIEnv * env, I_32 errorNumber)
 {
-  jclass aClass;
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   char *errorMessage = netLookupErrorString (env, errorNumber);
-  aClass = (*env)->FindClass (env, "java/net/SocketException");
-  if (0 == aClass)
-    {
-      return;
-    }
-  (*env)->ThrowNew (env, aClass, errorMessage);
-
+  throwNewExceptionByName(env, "java/net/SocketException", errorMessage);
 }
 
 /**
@@ -375,23 +366,17 @@
 void
 throwJavaNetUnknownHostException (JNIEnv * env, I_32 errorNumber)
 {
-  jclass aClass;
   char *errorMessage;
   if (errorNumber == HYPORT_ERROR_SOCKET_SYSTEMFULL)
     {
-      throwNewOutOfMemoryError (env, "");
+      throwNewOutOfMemoryError(env, "");
       return;
     }
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   errorMessage = netLookupErrorString (env, errorNumber);
-  aClass = (*env)->FindClass (env, "java/net/UnknownHostException");
-  if (0 == aClass)
-    {
-      return;
-    }
-  (*env)->ThrowNew (env, aClass, errorMessage);
-
+  throwNewExceptionByName(env, "java/net/UnknownHostException", errorMessage);
 }
 
 /**
@@ -405,17 +390,11 @@
 void
 throwJavaIoInterruptedIOException (JNIEnv * env, I_32 errorNumber)
 {
-  jclass aClass;
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   char *errorMessage = netLookupErrorString (env, errorNumber);
-  aClass = (*env)->FindClass (env, "java/io/InterruptedIOException");
-  if (0 == aClass)
-    {
-      return;
-    }
-  (*env)->ThrowNew (env, aClass, errorMessage);
-
+  throwNewExceptionByName(env, "java/io/InterruptedIOException", errorMessage);
 }
 
 /**
@@ -1237,17 +1216,12 @@
 void
 throwJavaNetPortUnreachableException (JNIEnv * env, I_32 errorNumber)
 {
-  jclass aClass;
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   char *errorMessage = netLookupErrorString (env, errorNumber);
-  aClass = (*env)->FindClass (env, "java/net/PortUnreachableException");
-  if (0 == aClass)
-    {
-      return;
-    }
-  (*env)->ThrowNew (env, aClass, errorMessage);
-
+  throwNewExceptionByName(env, "java/net/PortUnreachableException",
+                          errorMessage);
 }
 
 /**
@@ -1261,17 +1235,11 @@
 void
 throwJavaNetSocketTimeoutException (JNIEnv * env, I_32 errorNumber)
 {
-  jclass aClass;
-  /* the error message lookup should be done before the FindClass call, because the FindClass
call
-   * may reset the error number that is used in hysock_error_message */
+  /* the error message lookup should be done before the FindClass
+   * call, because the FindClass call may reset the error number that
+   * is used in hysock_error_message */
   char *errorMessage = netLookupErrorString (env, errorNumber);
-  aClass = (*env)->FindClass (env, "java/net/SocketTimeoutException");
-  if (0 == aClass)
-    {
-      return;
-    }
-  (*env)->ThrowNew (env, aClass, errorMessage);
-
+  throwNewExceptionByName(env, "java/net/SocketTimeoutException", errorMessage);
 }
 
 /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
Thu Jul 20 08:00:53 2006
@@ -46,14 +46,12 @@
   envLength = (*env)->GetArrayLength (env, arg2);
   if (commandLineLength >= 255)
     {
-      jclass exClass = (*env)->FindClass (env, "java/io/IOException");
-      (*env)->ThrowNew (env, exClass, "Too many arguments");
+      throwJavaIoIOException(env, "Too many arguments");
       return NULL;
     }
   if (envLength >= 255)
     {
-      jclass exClass = (*env)->FindClass (env, "java/io/IOException");
-      (*env)->ThrowNew (env, exClass, "Too many environment arguments");
+      throwJavaIoIOException(env, "Too many environment arguments");
       return NULL;
     }
 
@@ -140,8 +138,7 @@
             break;
         }
 
-        exClass = (*env)->FindClass (env, "java/io/IOException");
-        (*env)->ThrowNew (env, exClass, errMsg);
+        throwJavaIoIOException(env, errMsg);
         goto failed;
     }
 
@@ -235,8 +232,7 @@
   if (retVal < 0)
     {
       /* Couldn't read bytes */
-      jclass exClass = (*env)->FindClass (env, "java/io/IOException");
-      (*env)->ThrowNew (env, exClass, "Unable to peek on stream");
+      throwJavaIoIOException(env, "Unable to peek on stream");
     }
   return (jint) retVal;
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSMemory.c
Thu Jul 20 08:00:53 2006
@@ -27,14 +27,12 @@
 {
   PORT_ACCESS_FROM_ENV (env);
 
-  jclass exceptionClazz;
   void *address = hymem_allocate_memory ((UDATA) size);
 
   if (address == NULL)
     {
-      exceptionClazz = (*env)->FindClass (env, "java/lang/OutOfMemoryError");
-      (*env)->ThrowNew (env, exceptionClazz,
-                        "Insufficient memory available.");
+      throwNewOutOfMemoryError(env, "java/lang/OutOfMemoryError",
+                               "Insufficient memory available.");
     }
 
   return (jlong) address;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/shared/BidiWrapper.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/shared/BidiWrapper.c?rev=423950&r1=423949&r2=423950&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/shared/BidiWrapper.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/shared/BidiWrapper.c
Thu Jul 20 08:00:53 2006
@@ -153,8 +153,8 @@
   if (U_FAILURE (err))
     {
       sprintf (message, "ICU Internal Error: %d", err);
-      exception = (*env)->FindClass (env, "java/lang/RuntimeException");
-      (*env)->ThrowNew (env, exception, message);
+      throwNewExceptionByName(env, "java/lang/RuntimeException",
+                              message);
     }
 }
 



Mime
View raw message