changeset 171:f638f2f094f7

8011540: PropertyMap histories should not begin with empty map Reviewed-by: lagergren, sundar Contributed-by: james.laskey@oracle.com
author jlaskey
date Thu, 04 Apr 2013 09:05:38 -0300
parents be5d2e472e22
children 069923cc9de5
files src/jdk/nashorn/internal/runtime/PropertyMap.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk/nashorn/internal/runtime/PropertyMap.java	Tue Apr 02 11:38:04 2013 -0300
+++ b/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Apr 04 09:05:38 2013 -0300
@@ -540,11 +540,13 @@
      * @param newMap   Modified {@link PropertyMap}.
      */
     private void addToHistory(final Property property, final PropertyMap newMap) {
-        if (history == null) {
-            history = new LinkedHashMap<>();
+        if (!properties.isEmpty()) {
+            if (history == null) {
+                history = new LinkedHashMap<>();
+            }
+
+            history.put(property, newMap);
         }
-
-        history.put(property, newMap);
     }
 
     /**