|
|
@@ -785,17 +785,46 @@ public class EncryptExecutor {
|
|
|
// ignore
|
|
|
Logger.warn(EncryptExecutor.class, "Ignore clear-method-body for className [" + className + "], Cannot find '" + e.getMessage() + "'");
|
|
|
} catch (CannotCompileException e) {
|
|
|
- Throwable cause = e.getCause();
|
|
|
- if (cause instanceof NotFoundException) {
|
|
|
+ NotFoundException notFoundException = existNotFoundException(e, 5);
|
|
|
+ if (notFoundException != null) {
|
|
|
// ignore
|
|
|
- Logger.warn(EncryptExecutor.class, "Ignore clear-method-body for className [" + className + "], Cannot find '" + cause.getMessage() + "'");
|
|
|
+ Logger.warn(EncryptExecutor.class, "Ignore clear-method-body for className [" + className + "], Cannot find '" + notFoundException.getMessage() + "'");
|
|
|
+ } else {
|
|
|
+ throw new ClassWinterException(e);
|
|
|
}
|
|
|
- throw new ClassWinterException(e);
|
|
|
}
|
|
|
});
|
|
|
pool.clearImportedPackages();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 从异常链中寻找NotFoundException异常
|
|
|
+ *
|
|
|
+ * @param e 暴露异常
|
|
|
+ * @param depth 向下寻找深度
|
|
|
+ *
|
|
|
+ * @return NotFoundException异常(null-则表示未找到)
|
|
|
+ */
|
|
|
+ private NotFoundException existNotFoundException(CannotCompileException e, int depth) {
|
|
|
+ if (e == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (depth <= 0) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Throwable cause = e.getCause();
|
|
|
+ for (int i = 0; i < depth; i++) {
|
|
|
+ if (cause instanceof NotFoundException) {
|
|
|
+ return (NotFoundException)cause;
|
|
|
+ }
|
|
|
+ if (cause == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ cause = cause.getCause();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 加密class文件,并将加密后的class文件放在savaDir里
|
|
|
*
|