test/jdk/sun/security/util/Resources/customSysClassLoader/MessageFormatting.java
changeset 48762 85c27aabf312
parent 48757 8cc67294ec56
equal deleted inserted replaced
48761:74c1fa26435a 48762:85c27aabf312
    26 import sun.security.util.LocalizedMessage;
    26 import sun.security.util.LocalizedMessage;
    27 import java.text.MessageFormat;
    27 import java.text.MessageFormat;
    28 
    28 
    29 /*
    29 /*
    30  * @test
    30  * @test
    31  * @bug 8168075
    31  * @bug 8168075 8196215
    32  * @summary Ensure that security message formatting code is capable of
    32  * @summary Ensure that security message formatting code is capable of
    33  *     displaying all messages.
    33  *     displaying all messages.
    34  * @modules java.base/sun.security.util
    34  * @modules java.base/sun.security.util
       
    35  * @run main MessageFormatting
       
    36  * @run main/othervm -Duser.country=SA -Duser.language=ar MessageFormatting
    35  */
    37  */
    36 
    38 
    37 public class MessageFormatting {
    39 public class MessageFormatting {
    38 
    40 
    39     private static final Object[] MSG_ARGS = new Integer[]{0, 1, 2};
    41     private static final Object[] MSG_ARGS = new Integer[]{0, 1, 2};
    61     private static String formatIfNecessary(String str, Object[] args) {
    63     private static String formatIfNecessary(String str, Object[] args) {
    62         // message formatting code only formats messages with arguments
    64         // message formatting code only formats messages with arguments
    63         if (str.indexOf('{') < 0) {
    65         if (str.indexOf('{') < 0) {
    64             return str;
    66             return str;
    65         }
    67         }
    66         MessageFormat format = new MessageFormat(str);
    68         Locale loc = new Locale("en", "US");
       
    69         MessageFormat format = new MessageFormat(str, loc);
    67         return format.format(args);
    70         return format.format(args);
    68     }
    71     }
    69 }
    72 }