This is an automated email from the ASF dual-hosted git repository.

shaojunwang pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-java-tee-sdk.git

commit 333743bd4ff7d799f8babe24ff6d6d3943492cef
Author: jeffery.wsj <[email protected]>
AuthorDate: Fri May 13 13:31:50 2022 +0800

    [Enc] Register a method's exception class serialization annotated by 
EnclaveService
    
    Summary:
    1. Register a method's exception class serialization automatically
    2. Fix enclave module's exception handling mechanism
    
    Test Plan: all tests pass
    
    Reviewers: lei.yul, cengfeng.lzy, sanhong.lsh
    
    Issue: https://aone.alibaba-inc.com/task/41486113
    
    CR: 
https://code.aone.alibaba-inc.com/java-tee/JavaEnclave/codereview/8401257
---
 .../com/alibaba/confidentialcomputing/enclave/EnclaveFeature.java     | 3 +++
 .../confidentialcomputing/enclave/framework/ServiceMethodInvoker.java | 3 ---
 .../enclave/framework/ServiceMethodInvokerTest.java                   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/EnclaveFeature.java
 
b/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/EnclaveFeature.java
index fe36075..2c6a346 100644
--- 
a/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/EnclaveFeature.java
+++ 
b/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/EnclaveFeature.java
@@ -105,6 +105,9 @@ public class EnclaveFeature implements Feature {
                         serializationCandidateTypes.putIfAbsent(pType, false);
                     }
                     
serializationCandidateTypes.putIfAbsent(method.getReturnType(), false);
+                    for (Class<?> expType : method.getExceptionTypes()) {
+                        serializationCandidateTypes.putIfAbsent(expType, 
false);
+                    }
                     reflectionCandidateMethods.putIfAbsent(method, false);
                 }
         );
diff --git 
a/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvoker.java
 
b/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvoker.java
index 5ee639f..9eb07f3 100644
--- 
a/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvoker.java
+++ 
b/sdk/enclave/src/main/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvoker.java
@@ -57,9 +57,6 @@ public final class ServiceMethodInvoker implements 
EnclaveMethodInvoker<EnclaveI
             try {
                 // Call the actual method
                 returnedValue = method.invoke(receiverInstance, 
inputData.getArguments());
-            } catch (InvocationTargetException e) {
-                // The exception happens in the vocation is the user's 
exception, it will be returned to the user.
-                throwable = e;
             } catch (Throwable t) {
                 return new EnclaveInvocationResult(null, new 
ConfidentialComputingException(t));
             }
diff --git 
a/sdk/enclave/src/test/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvokerTest.java
 
b/sdk/enclave/src/test/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvokerTest.java
index b0fea25..22f3a70 100644
--- 
a/sdk/enclave/src/test/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvokerTest.java
+++ 
b/sdk/enclave/src/test/java/com/alibaba/confidentialcomputing/enclave/framework/ServiceMethodInvokerTest.java
@@ -30,7 +30,7 @@ public class ServiceMethodInvokerTest {
     private ServiceHandler[] services;
 
     @BeforeAll
-    public static void svmCheck(){
+    public static void svmCheck() {
         assumeFalse(isInNativeImage());
     }
 
@@ -71,7 +71,7 @@ public class ServiceMethodInvokerTest {
         assertNotNull(result);
         Object wrappedResult = result.getResult();
         assertNull(wrappedResult, "Expect to have non-null result from 
invoking service method call.");
-        Throwable e = result.getException();
+        Throwable e = result.getException().getCause();
         assertNotNull(e);
         assertTrue(e instanceof InvocationTargetException);
         assertTrue(((InvocationTargetException) e).getCause() instanceof 
ArithmeticException);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to