/[classpath]/classpath/native/jni/classpath/jcl.c
ViewVC logotype

Diff of /classpath/native/jni/classpath/jcl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by rupp, Wed Jul 16 10:34:54 2003 UTC revision 1.5 by iproetel, Mon Aug 11 13:44:05 2003 UTC
# Line 42  exception statement from your version. * Line 42  exception statement from your version. *
42  #include <stdio.h>  #include <stdio.h>
43  #include <jcl.h>  #include <jcl.h>
44    
 static char errstr[4098]; // this way the memory is pre-allocated, so that we do not have to worry if we are out of memory.  
   
45  JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg) {  JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg) {
46          jclass excClass;          jclass excClass;
47          if((*env)->ExceptionOccurred(env)) {          if((*env)->ExceptionOccurred(env)) {
# Line 56  JNIEXPORT void JNICALL JCL_ThrowExceptio Line 54  JNIEXPORT void JNICALL JCL_ThrowExceptio
54                  if(errExcClass == NULL) {                  if(errExcClass == NULL) {
55                          errExcClass = (*env)->FindClass(env, "java/lang/InternalError");                          errExcClass = (*env)->FindClass(env, "java/lang/InternalError");
56                          if(errExcClass == NULL) {                          if(errExcClass == NULL) {
57                                  sprintf(errstr,"JCL: Utterly failed to throw exeption %s with message %s.",className,errMsg);                                  fprintf(stderr, "JCL: Utterly failed to throw exeption ");
58                                  fprintf(stderr, errstr);                                  fprintf(stderr, className);
59                                    fprintf(stderr, " with message ");
60                                    fprintf(stderr, errMsg);
61                                  return;                                  return;
62                          }                          }
63                  }                  }
64                  sprintf(errstr,"JCL: Failed to throw exception %s with message %s: could not find exception class.", className, errMsg);                  /* Removed this (more comprehensive) error string to avoid the need for a
65                  (*env)->ThrowNew(env, errExcClass, errstr);                   * static variable or allocation of a buffer for this message in this (unlikely)
66                     * error case. --Fridi.
67                     *
68                     * sprintf(errstr,"JCL: Failed to throw exception %s with message %s: could not find exception class.", className, errMsg);
69                     */
70                    (*env)->ThrowNew(env, errExcClass, className);
71          }          }
72          (*env)->ThrowNew(env, excClass, errMsg);          (*env)->ThrowNew(env, excClass, errMsg);
73  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26