8078440: Safer managed types
authorsjiang
Thu, 07 May 2015 09:37:27 +0200
changeset 33279 ddef2c0a5c2a
parent 33278 b963d5ce87c5
child 33280 3aef4137620e
8078440: Safer managed types Reviewed-by: dfuchs, ahgross
jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java	Wed Oct 21 22:49:14 2015 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java	Thu May 07 09:37:27 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * 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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,6 @@
 import javax.management.ImmutableDescriptor;
 import javax.management.MBeanAttributeInfo;
 import com.sun.jmx.remote.util.EnvHelp;
-import sun.reflect.misc.ConstructorUtil;
 import sun.reflect.misc.MethodUtil;
 import sun.reflect.misc.ReflectUtil;
 
@@ -692,8 +691,9 @@
     private static <T> T convertFromString(String s, OpenType<T> openType) {
         Class<T> c;
         try {
-            ReflectUtil.checkPackageAccess(openType.safeGetClassName());
-            c = cast(Class.forName(openType.safeGetClassName()));
+            String className = openType.safeGetClassName();
+            ReflectUtil.checkPackageAccess(className);
+            c = cast(Class.forName(className));
         } catch (ClassNotFoundException e) {
             throw new NoClassDefFoundError(e.toString());  // can't happen
         }