You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/01/18 03:43:22 UTC
[incubator-servicecomb-java-chassis] 01/05: SCB-251 print method
source when dynamic create method failed.
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit 5454d18f50bbec874f10f9aab6558907d322ec06
Author: wujimin <wu...@huawei.com>
AuthorDate: Thu Jan 18 00:15:46 2018 +0800
SCB-251 print method source when dynamic create method failed.
---
.../apache/servicecomb/common/javassist/JavassistUtils.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java
index 41cd844..f75247f 100644
--- a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java
+++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java
@@ -172,11 +172,16 @@ public final class JavassistUtils {
}
for (MethodConfig methodConfig : config.getMethodList()) {
- CtMethod ctMethod = CtMethod.make(methodConfig.getSource(), ctClass);
- if (methodConfig.getGenericSignature() != null) {
- ctMethod.setGenericSignature(methodConfig.getGenericSignature());
+ try {
+ CtMethod ctMethod = CtMethod.make(methodConfig.getSource(), ctClass);
+ if (methodConfig.getGenericSignature() != null) {
+ ctMethod.setGenericSignature(methodConfig.getGenericSignature());
+ }
+ ctClass.addMethod(ctMethod);
+ } catch (CannotCompileException e) {
+ LOGGER.error("Failed to create method, source:\n{}.", methodConfig.getSource());
+ throw e;
}
- ctClass.addMethod(ctMethod);
}
LOGGER.info("generate {} in classLoader {}.", config.getClassName(), classLoader);
--
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.