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

Francis ANDRE francis.andre.kampbell at orange.fr
Sat Oct 26 09:22:00 PDT 2013


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)) {
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