jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java
changeset 22053 09b848a5794d
parent 18574 4aeaeb541678
child 23010 6dadb192ad81
equal deleted inserted replaced
22052:07af87cd2302 22053:09b848a5794d
    69  * @see java.nio.charset.Charset
    69  * @see java.nio.charset.Charset
    70  */
    70  */
    71 
    71 
    72 public abstract class CharsetProvider {
    72 public abstract class CharsetProvider {
    73 
    73 
       
    74     private static Void checkPermission() {
       
    75         SecurityManager sm = System.getSecurityManager();
       
    76         if (sm != null)
       
    77             sm.checkPermission(new RuntimePermission("charsetProvider"));
       
    78         return null;
       
    79     }
       
    80     private CharsetProvider(Void ignore) { }
       
    81 
    74     /**
    82     /**
    75      * Initializes a new charset provider.
    83      * Initializes a new charset provider.
    76      *
    84      *
    77      * @throws  SecurityException
    85      * @throws  SecurityException
    78      *          If a security manager has been installed and it denies
    86      *          If a security manager has been installed and it denies
    79      *          {@link RuntimePermission}<tt>("charsetProvider")</tt>
    87      *          {@link RuntimePermission}<tt>("charsetProvider")</tt>
    80      */
    88      */
    81     protected CharsetProvider() {
    89     protected CharsetProvider() {
    82         SecurityManager sm = System.getSecurityManager();
    90         this(checkPermission());
    83         if (sm != null)
       
    84             sm.checkPermission(new RuntimePermission("charsetProvider"));
       
    85     }
    91     }
    86 
    92 
    87     /**
    93     /**
    88      * Creates an iterator that iterates over the charsets supported by this
    94      * Creates an iterator that iterates over the charsets supported by this
    89      * provider.  This method is used in the implementation of the {@link
    95      * provider.  This method is used in the implementation of the {@link