8165984: ResourceBundle lookup fields not completely thread-safe
Reviewed-by: okutsu, naoto
--- a/jdk/src/java.base/share/classes/java/util/ListResourceBundle.java Sat Sep 17 16:37:52 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/ListResourceBundle.java Sun Sep 18 23:09:37 2016 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, 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
@@ -206,5 +206,5 @@
lookup = temp;
}
- private Map<String,Object> lookup = null;
+ private volatile Map<String,Object> lookup = null;
}
--- a/jdk/src/java.base/share/classes/java/util/PropertyResourceBundle.java Sat Sep 17 16:37:52 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/PropertyResourceBundle.java Sun Sep 18 23:09:37 2016 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, 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
@@ -46,8 +46,6 @@
import java.nio.charset.MalformedInputException;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnmappableCharacterException;
-import java.security.AccessController;
-import java.util.Locale;
import sun.security.action.GetPropertyAction;
import sun.util.PropertyResourceBundleCharset;
import sun.util.ResourceBundleEnumeration;
@@ -236,5 +234,5 @@
// ==================privates====================
- private Map<String,Object> lookup;
+ private final Map<String,Object> lookup;
}