aboutsummaryrefslogtreecommitdiff
path: root/test/java/io/pathNames
diff options
context:
space:
mode:
authorxuelei <none@none>2011-07-29 02:50:58 -0700
committerxuelei <none@none>2011-07-29 02:50:58 -0700
commit4f8e2cd03def2d9de59cacaca0193fa136ae4745 (patch)
tree9fc9e567009b754982b5194694feb66e8606e5ef /test/java/io/pathNames
parentd425c7f1c47bf3c234e85bbdf1efcb941a3a9a3b (diff)
downloadjdk8u_jdk-4f8e2cd03def2d9de59cacaca0193fa136ae4745.tar.gz
7068662: Reserve and restore the default locale
Reviewed-by: alanb, weijun
Diffstat (limited to 'test/java/io/pathNames')
-rw-r--r--test/java/io/pathNames/win32/bug6344646.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/java/io/pathNames/win32/bug6344646.java b/test/java/io/pathNames/win32/bug6344646.java
index 227adc87ed..d39dd40cf3 100644
--- a/test/java/io/pathNames/win32/bug6344646.java
+++ b/test/java/io/pathNames/win32/bug6344646.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,17 +32,24 @@ import java.util.*;
public class bug6344646 {
public static void main(String[] s) {
- /* This test is only valid on win32 systems */
- if (File.separatorChar != '\\') {
- return;
- }
+ Locale reservedLocale = Locale.getDefault();
+ try {
+ /* This test is only valid on win32 systems */
+ if (File.separatorChar != '\\') {
+ return;
+ }
- Locale.setDefault(new Locale("lt"));
- File f1 = new File("J\u0301");
- File f2 = new File("j\u0301");
+ Locale.setDefault(new Locale("lt"));
+ File f1 = new File("J\u0301");
+ File f2 = new File("j\u0301");
- if (f1.hashCode() != f2.hashCode()) {
- throw new RuntimeException("File.hashCode() for \"J\u0301\" and \"j\u0301\" should be the same");
+ if (f1.hashCode() != f2.hashCode()) {
+ throw new RuntimeException("File.hashCode() for \"J\u0301\" " +
+ "and \"j\u0301\" should be the same");
+ }
+ } finally {
+ // restore the reserved locale
+ Locale.setDefault(reservedLocale);
}
}
}