]> granicus.if.org Git - icu/commitdiff
ICU-9941 Fixed a coding problem detected by FindBugs - changed put with putIfAbsent...
authorYoshito Umaoka <y.umaoka@gmail.com>
Fri, 15 Feb 2013 17:06:32 +0000 (17:06 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Fri, 15 Feb 2013 17:06:32 +0000 (17:06 +0000)
X-SVN-Rev: 33237

icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneNamesImpl.java

index c9c0de9d3cb5e850c6030401512e990f756fd1fd..120ebc41e7afa2955698552edc37019fb1e41c11 100644 (file)
@@ -287,7 +287,8 @@ public class TimeZoneNamesImpl extends TimeZoneNames {
                     _namesTrie.put(name, info);
                 }
             }
-            _mzNamesMap.put(mzID, znames);
+            ZNames tmpZnames = _mzNamesMap.putIfAbsent(mzID, znames);
+            znames = (tmpZnames == null) ? znames : tmpZnames;
         }
         return znames;
     }
@@ -313,7 +314,8 @@ public class TimeZoneNamesImpl extends TimeZoneNames {
                     _namesTrie.put(name, info);
                 }
             }
-            _tzNamesMap.put(tzID, tznames);
+            TZNames tmpTznames = _tzNamesMap.putIfAbsent(tzID, tznames);
+            tznames = (tmpTznames == null) ? tznames : tmpTznames;
         }
         return tznames;
     }