jdk/src/share/classes/javax/swing/text/NumberFormatter.java
changeset 20800 1f6b7d81410d
parent 7668 d4a77089c587
child 20854 242194ae1563
equal deleted inserted replaced
20799:4820649a142d 20800:1f6b7d81410d
    25 package javax.swing.text;
    25 package javax.swing.text;
    26 
    26 
    27 import java.lang.reflect.*;
    27 import java.lang.reflect.*;
    28 import java.text.*;
    28 import java.text.*;
    29 import java.util.*;
    29 import java.util.*;
       
    30 import sun.reflect.misc.ReflectUtil;
       
    31 import sun.swing.SwingUtilities2;
    30 
    32 
    31 /**
    33 /**
    32  * <code>NumberFormatter</code> subclasses <code>InternationalFormatter</code>
    34  * <code>NumberFormatter</code> subclasses <code>InternationalFormatter</code>
    33  * adding special behavior for numbers. Among the specializations are
    35  * adding special behavior for numbers. Among the specializations are
    34  * (these are only used if the <code>NumberFormatter</code> does not display
    36  * (these are only used if the <code>NumberFormatter</code> does not display
   425 
   427 
   426                     if (valueClass == null) {
   428                     if (valueClass == null) {
   427                         valueClass = value.getClass();
   429                         valueClass = value.getClass();
   428                     }
   430                     }
   429                     try {
   431                     try {
       
   432                         ReflectUtil.checkPackageAccess(valueClass);
       
   433                         SwingUtilities2.checkAccess(valueClass.getModifiers());
   430                         Constructor cons = valueClass.getConstructor(
   434                         Constructor cons = valueClass.getConstructor(
   431                                               new Class[] { String.class });
   435                                               new Class[] { String.class });
   432 
       
   433                         if (cons != null) {
   436                         if (cons != null) {
       
   437                             SwingUtilities2.checkAccess(cons.getModifiers());
   434                             return cons.newInstance(new Object[]{string});
   438                             return cons.newInstance(new Object[]{string});
   435                         }
   439                         }
   436                     } catch (Throwable ex) { }
   440                     } catch (Throwable ex) { }
   437                 }
   441                 }
   438             }
   442             }