hughesjr / rpms / tzdata

Forked from rpms/tzdata 2 years ago
Clone
f3bcf1
--- sun/tools/javazic/Mappings.java.orig	2015-04-13 12:44:10.000000000 -0400
f3bcf1
+++ sun/tools/javazic/Mappings.java	2015-04-13 12:45:28.000000000 -0400
f3bcf1
@@ -1,5 +1,5 @@
f3bcf1
 /*
f3bcf1
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
f3bcf1
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
f3bcf1
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f3bcf1
  *
f3bcf1
  * This code is free software; you can redistribute it and/or modify it
f3bcf1
@@ -26,6 +26,7 @@
f3bcf1
 package sun.tools.javazic;
f3bcf1
 
f3bcf1
 import	java.util.ArrayList;
f3bcf1
+import java.util.HashMap;
f3bcf1
 import	java.util.LinkedList;
f3bcf1
 import	java.util.List;
f3bcf1
 import	java.util.Map;
f3bcf1
@@ -162,6 +163,20 @@
f3bcf1
 	for (String key : toBeRemoved) {
f3bcf1
 	    aliases.remove(key);
f3bcf1
 	}
f3bcf1
+        // Eliminate any alias-to-alias mappings. For example, if
f3bcf1
+        // there are A->B and B->C, A->B is changed to A->C.
f3bcf1
+        Map<String, String> newMap = new HashMap<String, String>();
f3bcf1
+        for (String key : aliases.keySet()) {
f3bcf1
+            String realid = aliases.get(key);
f3bcf1
+            String leaf = realid;
f3bcf1
+            while (aliases.get(leaf) != null) {
f3bcf1
+                leaf = aliases.get(leaf);
f3bcf1
+            }
f3bcf1
+            if (!realid.equals(leaf)) {
f3bcf1
+                newMap.put(key, leaf);
f3bcf1
+            }
f3bcf1
+        }
f3bcf1
+        aliases.putAll(newMap);
f3bcf1
     }
f3bcf1
 
f3bcf1
     Map<String,String> getAliases() {