src/JavaVM.st
branchjk_new_structure
changeset 1428 902a1435f4ca
parent 1427 13f3765a9bba
child 1433 cc7b8e8cd814
--- a/src/JavaVM.st	Sun Mar 18 16:59:02 2012 +0000
+++ b/src/JavaVM.st	Sun Mar 18 22:39:53 2012 +0000
@@ -3630,7 +3630,7 @@
         ] ifFalse:[
             srchCon isHandleContext ifTrue:[
                 handler := srchCon receiver 
-                    handlerForSignal: aJavaException context: srchCon originator:thisContext sender.
+                    handlerForSignal: aJavaException class context: srchCon originator:thisContext sender.
                 handler notNil ifTrue:[
                     "We have found a Smalltalk handler for Java exception here"
                     handlerContext := srchCon.
@@ -3673,10 +3673,20 @@
             handlerContext unwindAndRestartForJavaException.
             self halt: 'should not be reached'.
         ] ifFalse:[
+            | val |    
             "/
             "/ found a Smalltalk exception handler
             "/
-            self halt:'Mhh, mhh, what to do here?'
+            "/ First, call evaluate the handler (see GenericException>>doCallHandler:
+            val := handler valueWithOptionalArgument: aJavaException.
+            "handler fall through - is just like a #return:(aHandlerBlock value)"
+
+            "Java exceptions cannot be proceed (by design)  but they might be
+            rejected (rethrown) - this is not supported yet - we need
+            to somehow indicate that (kind of reject token object returned
+            from handler?)"
+            thisContext evaluateUnwindActionsUpTo:handlerContext.
+            handlerContext return: val.
         ].
     ].
     Processor activeProcess == JavaScreenUpdaterThread ifTrue: [ self halt ].
@@ -3689,7 +3699,7 @@
     "Created: / 07-01-1998 / 15:28:22 / cg"
     "Modified: / 24-12-1999 / 02:33:25 / cg"
     "Modified: / 01-12-2011 / 18:32:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 18-03-2012 / 12:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-03-2012 / 21:47:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 throwExceptionClassName: aJavaExceptionClassName withMessage: someMessage