You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by sh...@apache.org on 2022/11/11 05:18:06 UTC
[incubator-teaclave-java-tee-sdk] 26/48: [sdk] Fix method invoking bug with empty input parameter in svm enclave sdk
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 158d5a809c354eafc087fdb75113a06df8db3dcd
Author: jeffery.wsj <je...@alibaba-inc.com>
AuthorDate: Tue Jul 19 18:04:09 2022 +0800
[sdk] Fix method invoking bug with empty input parameter in svm enclave sdk
Summary: Fix method invoking bug with empty input parameter in svm enclave sdk
Test Plan: all tests pass
Reviewers: lei.yul, cengfeng.lzy, sanhong.lsh
Issue: https://aone.alibaba-inc.com/task/43414675
CR: https://code.aone.alibaba-inc.com/java-tee/JavaEnclave/codereview/9440430
---
.../enclave/framework/ServiceMethodInvoker.java | 2 ++
.../alibaba/confidentialcomputing/test/common/SayHelloService.java | 1 +
.../confidentialcomputing/test/enclave/SayHelloServiceImpl.java | 5 +++++
.../confidentialcomputing/test/host/TestJavaEnclaveService.java | 1 +
4 files changed, 9 insertions(+)
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 9eb07f3..8387804 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
@@ -9,6 +9,7 @@ import jdk.vm.ci.meta.MetaUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -68,6 +69,7 @@ public final class ServiceMethodInvoker implements EnclaveMethodInvoker<EnclaveI
}
private static List<Class<?>> extractParamClasses(String[] parameterTypes) {
+ if (parameterTypes == null) return Collections.emptyList();
List<Class<?>> parameterClassList = new ArrayList<>();
for (String parameterType : parameterTypes) {
try {
diff --git a/test/common/src/main/java/com/alibaba/confidentialcomputing/test/common/SayHelloService.java b/test/common/src/main/java/com/alibaba/confidentialcomputing/test/common/SayHelloService.java
index c3016b0..120a8f8 100644
--- a/test/common/src/main/java/com/alibaba/confidentialcomputing/test/common/SayHelloService.java
+++ b/test/common/src/main/java/com/alibaba/confidentialcomputing/test/common/SayHelloService.java
@@ -5,4 +5,5 @@ import com.alibaba.confidentialcomputing.common.annotations.EnclaveService;
@EnclaveService
public interface SayHelloService {
String sayHelloService(String plainText);
+ String sayHelloWorld();
}
\ No newline at end of file
diff --git a/test/enclave/src/main/java/com/alibaba/confidentialcomputing/test/enclave/SayHelloServiceImpl.java b/test/enclave/src/main/java/com/alibaba/confidentialcomputing/test/enclave/SayHelloServiceImpl.java
index 2dfd70c..4327bc2 100644
--- a/test/enclave/src/main/java/com/alibaba/confidentialcomputing/test/enclave/SayHelloServiceImpl.java
+++ b/test/enclave/src/main/java/com/alibaba/confidentialcomputing/test/enclave/SayHelloServiceImpl.java
@@ -10,4 +10,9 @@ public class SayHelloServiceImpl implements SayHelloService {
public String sayHelloService(String plainText) {
return plainText;
}
+
+ @Override
+ public String sayHelloWorld() {
+ return "Hello World";
+ }
}
\ No newline at end of file
diff --git a/test/host/src/test/java/com/alibaba/confidentialcomputing/test/host/TestJavaEnclaveService.java b/test/host/src/test/java/com/alibaba/confidentialcomputing/test/host/TestJavaEnclaveService.java
index c913318..741bb3d 100644
--- a/test/host/src/test/java/com/alibaba/confidentialcomputing/test/host/TestJavaEnclaveService.java
+++ b/test/host/src/test/java/com/alibaba/confidentialcomputing/test/host/TestJavaEnclaveService.java
@@ -34,6 +34,7 @@ public class TestJavaEnclaveService {
assertTrue(userServices.hasNext());
SayHelloService service = userServices.next();
String result = service.sayHelloService(plain);
+ assertEquals("Hello World", service.sayHelloWorld());
enclave.destroy();
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org