提交 03992387 编写于 作者: S sjiang

8078440: Safer managed types

Reviewed-by: dfuchs, ahgross
上级 d096a9c5
/* /*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -45,7 +45,6 @@ import javax.management.DescriptorRead; ...@@ -45,7 +45,6 @@ import javax.management.DescriptorRead;
import javax.management.ImmutableDescriptor; import javax.management.ImmutableDescriptor;
import javax.management.MBeanAttributeInfo; import javax.management.MBeanAttributeInfo;
import com.sun.jmx.remote.util.EnvHelp; import com.sun.jmx.remote.util.EnvHelp;
import sun.reflect.misc.ConstructorUtil;
import sun.reflect.misc.MethodUtil; import sun.reflect.misc.MethodUtil;
import sun.reflect.misc.ReflectUtil; import sun.reflect.misc.ReflectUtil;
...@@ -692,8 +691,9 @@ public class OpenMBeanAttributeInfoSupport ...@@ -692,8 +691,9 @@ public class OpenMBeanAttributeInfoSupport
private static <T> T convertFromString(String s, OpenType<T> openType) { private static <T> T convertFromString(String s, OpenType<T> openType) {
Class<T> c; Class<T> c;
try { try {
ReflectUtil.checkPackageAccess(openType.safeGetClassName()); String className = openType.safeGetClassName();
c = cast(Class.forName(openType.safeGetClassName())); ReflectUtil.checkPackageAccess(className);
c = cast(Class.forName(className));
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.toString()); // can't happen throw new NoClassDefFoundError(e.toString()); // can't happen
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册