Skip to content

Commit

Permalink
fix issue alibaba#267
Browse files Browse the repository at this point in the history
  • Loading branch information
南琛 committed Mar 27, 2020
1 parent bea210b commit b58d794
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,37 @@ && isSandboxPrefix(internalClassName)) {

// 类被com.alibaba.jvm.sandbox开头的ClassLoader所加载
if (null != loader
&& isSandboxPrefix(loader.getClass().getName())) {
// fix issue #267
&& isSandboxPrefix(normalizeClass(loader.getClass().getName()))) {
return true;
}

return false;

}

/**
* 标准化类名
* <p>
* 入参:com.alibaba.jvm.sandbox
* 返回:com/alibaba/jvm/sandbox
* </p>
*
* @param className 类名
* @return 标准化类名
*/
private static String normalizeClass(String className) {
return className.replace(".", "/");
}

/**
* 是否是sandbox自身的类
* <p>
* 需要注意internalClassName的格式形如: com/alibaba/jvm/sandbox
*
* @param internalClassName 类资源名
* @return true / false
*/
private static boolean isSandboxPrefix(String internalClassName) {
return internalClassName.startsWith(SANDBOX_FAMILY_CLASS_RES_PREFIX)
&& !isQaTestPrefix(internalClassName);
Expand Down

0 comments on commit b58d794

Please sign in to comment.