[7u]: patches for the jdk jtreg tests for non US locale

Daniel Fuchs daniel.fuchs at oracle.com
Mon Oct 28 01:33:33 PDT 2013


Hi Francis,

The first change in the first patch looks very suspect to me:
It looks as if you're reverting a change I made a few weeks ago,
namely changing "Severe" back into "SEVERE".

http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/rev/ffd0a74b30d6

The localization bundles are supposed to contain "Severe".

(see below)

On 10/26/13 6:22 PM, Francis ANDRE wrote:
> Hi
>
> Here patches for making the jdk jtreg tests succeed
>
> 1/ java.util.logging jtreg tests working in a country where the locale
> is different from en_US
> 2/ An java.net.URL test that fails with ConnectionException instead of
> UnknownHostException.
>
>
>
> diff --git a/test/java/util/logging/LevelResourceBundle.java
> b/test/java/util/logging/LevelResourceBundle.java
> --- a/test/java/util/logging/LevelResourceBundle.java
> +++ b/test/java/util/logging/LevelResourceBundle.java
> @@ -33,8 +33,9 @@
>
>   public class LevelResourceBundle {
>       public static void main(String args[]) throws Exception {
> +        Locale.setDefault(Locale.US);
>           final String key = "SEVERE";
> -        final String name = "Severe";
> +        final String name = "SEVERE";
>           String en = getLocalizedMessage(Locale.getDefault(), key);
>           String fr = getLocalizedMessage(Locale.FRANCE, key);
>           if (!name.equals(en)) {

Here 'en' should be "Severe" - if it's not it may indicate that
there is an issue with the localization bundles - or that you're
not running the test with the appropriate JDK.

For instance, if you look at the default bundle - you will see that it
contains SEVERE=Severe:

http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/tip/src/share/classes/sun/util/logging/resources/logging.properties

Best regards

-- daniel

> diff --git a/test/java/util/logging/SimpleFormatterFormat.java
> b/test/java/util/logging/SimpleFormatterFormat.java
> --- a/test/java/util/logging/SimpleFormatterFormat.java
> +++ b/test/java/util/logging/SimpleFormatterFormat.java
> @@ -38,6 +38,7 @@
>       private static final String origFormat = System.getProperty(key);
>       private static final PrintStream err = System.err;
>       public static void main(String[] args) throws Exception {
> +        Locale.setDefault(Locale.US);
>           try {
>               File dir = new File(System.getProperty("user.dir", "."));
>               File log = new File(dir, "simpleformat.txt");
> diff --git a/test/sun/util/logging/SourceClassName.java
> b/test/sun/util/logging/SourceClassName.java
> --- a/test/sun/util/logging/SourceClassName.java
> +++ b/test/sun/util/logging/SourceClassName.java
> @@ -37,6 +37,7 @@
>
>   public class SourceClassName {
>       public static void main(String[] args) throws Exception {
> +        Locale.setDefault(Locale.US);
>           File dir = new File(System.getProperty("user.dir", "."));
>           File log = new File(dir, "testlog.txt");
>           PrintStream logps = new PrintStream(log);
>
>
> diff --git a/test/java/net/URL/OpenStream.java
> b/test/java/net/URL/OpenStream.java
> --- a/test/java/net/URL/OpenStream.java
> +++ b/test/java/net/URL/OpenStream.java
> @@ -41,6 +41,8 @@
>               InputStream in = u.openStream();
>           } catch (UnknownHostException x) {
>               return;
> +        } catch (ConnectException x) {
> +            return;
>           }
>           throw new RuntimeException("Expected UnknownHostException to
> be thrown");
>
>
> Francis




More information about the jdk7u-dev mailing list