src/java.base/share/classes/sun/util/locale/provider/HostLocaleProviderAdapter.java
changeset 59043 1a79b4bfc85a
parent 47216 71c04702a3d5
equal deleted inserted replaced
59042:8910b995a2ee 59043:1a79b4bfc85a
     1 /*
     1 /*
     2  * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    25 
    25 
    26 package sun.util.locale.provider;
    26 package sun.util.locale.provider;
    27 
    27 
    28 import java.lang.reflect.InvocationTargetException;
    28 import java.lang.reflect.InvocationTargetException;
    29 import java.lang.reflect.Method;
    29 import java.lang.reflect.Method;
       
    30 import java.text.DecimalFormat;
    30 import java.util.spi.LocaleServiceProvider;
    31 import java.util.spi.LocaleServiceProvider;
    31 
    32 
    32 /**
    33 /**
    33  * LocaleProviderAdapter implementation for the host locale data.
    34  * LocaleProviderAdapter implementation for the host locale data.
    34  * Currently it is only implemented on Windows Vista or later.
    35  * Currently it is only implemented on Windows Vista or later.
    58                   InvocationTargetException ex) {
    59                   InvocationTargetException ex) {
    59             LocaleServiceProviderPool.config(HostLocaleProviderAdapter.class, ex.toString());
    60             LocaleServiceProviderPool.config(HostLocaleProviderAdapter.class, ex.toString());
    60         }
    61         }
    61         return null;
    62         return null;
    62     }
    63     }
       
    64 
       
    65     /**
       
    66      * Utility to make the decimal format specific to integer, called
       
    67      * by the platform dependent adapter implementations.
       
    68      *
       
    69      * @param df A DecimalFormat object
       
    70      * @return The same DecimalFormat object in the argument, modified
       
    71      *          to allow integer formatting/parsing only.
       
    72      */
       
    73     static DecimalFormat makeIntegerFormatter(DecimalFormat df) {
       
    74         df.setMaximumFractionDigits(0);
       
    75         df.setDecimalSeparatorAlwaysShown(false);
       
    76         df.setParseIntegerOnly(true);
       
    77         return df;
       
    78     }
    63 }
    79 }