[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII ptII.c, 1.10, 1.11

Elaine Cheong celaine at users.sourceforge.net
Mon Dec 11 02:13:01 PST 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28867/tos/platform/ptII

Modified Files:
	ptII.c 
Log Message:
Implemented JNI exception handling for socket methods.



Index: ptII.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII/ptII.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ptII.c	9 Dec 2006 10:17:21 -0000	1.10
--- ptII.c	11 Dec 2006 10:12:57 -0000	1.11
***************
*** 125,133 ****
  char ERROR_MESSAGE[ERROR_MESSAGE_SIZE];
  
! // Utility function that throws a named exception.  Finds the
! // exception class and then issues a call to the ThrowNew function.
! // Arguments: env: Java environment
! //            name: name (including path) of exception class
! //            msg: error message
   void JNU_ThrowByName(JNIEnv *env, const char *name, const char *msg) {
       jclass cls = (*env)->FindClass(env, name);
--- 125,135 ----
[...2606 lines suppressed...]
!         // returns a negative number.
!         // Does not throw an exception, so throw our own.
!         snprintf(ERROR_MESSAGE, sizeof(ERROR_MESSAGE),
!                 "\nError in %s[%d]: \nCall to AttachCurrentThread() returned a negative number.", 
!                 __FILE__, __LINE__);
!         JNU_ThrowByName(env,
!                 "ptolemy/kernel/util/InternalErrorException", ERROR_MESSAGE);
          return;
      }
***************
*** 1397,1399 ****
--- 2004,2011 ----
  
      (*env)->CallVoidMethod(env, lock, ptII_jmethodID_Object_notifyAll);
+     jthrowable throwable = NULL;
+     if (throwable = (*env)->ExceptionOccurred(env)) {
+         // Throw the exception to ptII.
+         (*env)->Throw(env, throwable);
+     }    
  }



More information about the Tinyos-contrib-commits mailing list