11/*
2- * Copyright 2019-2022 VMware, Inc.
2+ * Copyright 2019-2025 VMware, Inc.
33 * SPDX-License-Identifier: EPL-2.0
44 */
55package com .vmware .i18n .utils .timezone ;
1717import java .util .TimeZone ;
1818import java .util .TreeMap ;
1919
20- import org .json .simple . JSONArray ;
21- import org .json .simple . JSONObject ;
20+ import org .json .JSONArray ;
21+ import org .json .JSONObject ;
2222
2323import com .fasterxml .jackson .annotation .JsonInclude ;
2424import com .fasterxml .jackson .core .JsonProcessingException ;
@@ -33,10 +33,11 @@ public static Map<String, JSONArray> findTimezoneKeys(JSONObject metaZonesJson)
3333 JSONObject timzone = (JSONObject ) select (metaZonesJson , "supplemental.metaZones.metazoneInfo.timezone" );
3434 Map <String , JSONArray > result = new TreeMap <String , JSONArray >();
3535 if (timzone != null ) {
36- for (Entry <String , Object > entry : (Set <Map .Entry <String , Object >>) timzone .entrySet ()) {
37- String zoneKeystr1 = entry .getKey ();
38- Object obj1 = entry .getValue ();
39- if (obj1 instanceof List ) {
36+ for (String key : (Set <String >) timzone .keySet ()) {
37+ // for (Entry<String, Object> entry : (Set<Map.Entry<String, Object>>) timzone.entrySet()) {
38+ String zoneKeystr1 = key ;
39+ Object obj1 = timzone .get (key );
40+ if (obj1 instanceof JSONArray ) {
4041 JSONArray objArry = (JSONArray ) obj1 ;
4142 JSONObject usesMetazones = (JSONObject ) objArry .get (0 );
4243 JSONObject usesMetazoneObj = (JSONObject ) usesMetazones .get (Constants .TIMEZONENAME_USES_METAZONE );
@@ -46,10 +47,11 @@ public static Map<String, JSONArray> findTimezoneKeys(JSONObject metaZonesJson)
4647 }
4748 }
4849 JSONObject jsonObj1 = (JSONObject ) obj1 ;
49- for (Entry <String , Object > entry1 : (Set <Map .Entry <String , Object >>) jsonObj1 .entrySet ()) {
50- String zoneKeystr2 = entry1 .getKey ();
51- Object obj2 = entry1 .getValue ();
52- if (obj2 instanceof List ) {
50+ for (String key1 : (Set <String >) jsonObj1 .keySet ()) {
51+ // for (Entry<String, Object> entry1 : (Set<Map.Entry<String, Object>>) jsonObj1.entrySet()) {
52+ String zoneKeystr2 = key1 ;
53+ Object obj2 = jsonObj1 .get (key1 );
54+ if (obj2 instanceof JSONArray ) {
5355 JSONArray objArry2 = (JSONArray ) obj2 ;
5456 JSONObject usesMetazones2 = (JSONObject ) objArry2 .get (0 );
5557 JSONObject usesMetazoneObj2 = (JSONObject ) usesMetazones2
@@ -61,10 +63,11 @@ public static Map<String, JSONArray> findTimezoneKeys(JSONObject metaZonesJson)
6163 }
6264 }
6365 JSONObject jsonObj2 = (JSONObject ) obj2 ;
64- for (Entry <String , Object > entry2 : (Set <Map .Entry <String , Object >>) jsonObj2 .entrySet ()) {
65- String zoneKeystr3 = entry2 .getKey ();
66- Object obj3 = entry2 .getValue ();
67- if (obj3 instanceof List ) {
66+ for (String key2 : (Set <String >) jsonObj2 .keySet ()) {
67+ // for (Entry<String, Object> entry2 : (Set<Map.Entry<String, Object>>) jsonObj2.entrySet()) {
68+ String zoneKeystr3 = key2 ;
69+ Object obj3 = jsonObj2 .get (key2 );
70+ if (obj3 instanceof JSONArray ) {
6871 JSONArray objArry3 = (JSONArray ) obj3 ;
6972 JSONObject usesMetazones3 = (JSONObject ) objArry3 .get (0 );
7073 JSONObject usesMetazoneObj3 = (JSONObject ) usesMetazones3
@@ -76,10 +79,11 @@ public static Map<String, JSONArray> findTimezoneKeys(JSONObject metaZonesJson)
7679 }
7780 }
7881 JSONObject jsonObj3 = (JSONObject ) obj3 ;
79- for (Entry <String , Object > entry3 : (Set <Map .Entry <String , Object >>) jsonObj3 .entrySet ()) {
80- String zoneKeystr4 = entry3 .getKey ();
81- Object obj4 = entry3 .getValue ();
82- if (obj4 instanceof List ) {
82+ for (String key3 : (Set <String >) jsonObj3 .keySet ()) {
83+ // for (Entry<String, Object> entry3 : (Set<Map.Entry<String, Object>>) jsonObj3.entrySet()) {
84+ String zoneKeystr4 = key3 ;
85+ Object obj4 = jsonObj3 .get (key3 );
86+ if (obj4 instanceof JSONArray ) {
8387 JSONArray objArry4 = (JSONArray ) obj4 ;
8488 JSONObject usesMetazones4 = (JSONObject ) objArry4 .get (0 );
8589 JSONObject usesMetazoneObj4 = (JSONObject ) usesMetazones4
@@ -116,9 +120,9 @@ public static String createTimeZoneNameJson(JSONObject metaZonesJson, JSONObject
116120 Map <String , JSONArray > timezoneKeysProps = findTimezoneKeys (metaZonesJson );
117121 Map <String , List <JSONObject >> mapZonesMap = new TreeMap <String , List <JSONObject >>();
118122 if (arry != null ) {
119- Iterator <JSONObject > iterator = arry .iterator ();
123+ Iterator <Object > iterator = arry .iterator ();
120124 while (iterator .hasNext ()) {
121- JSONObject objZone = iterator .next ();
125+ JSONObject objZone = ( JSONObject ) iterator .next ();
122126 String timezoneKey = (String ) select (objZone , "mapZone._type" );
123127 if (mapZonesMap .get (timezoneKey ) != null ) {
124128 mapZonesMap .get (timezoneKey ).add (objZone );
@@ -139,10 +143,10 @@ public static String createTimeZoneNameJson(JSONObject metaZonesJson, JSONObject
139143 JSONArray mataZoneP = entry .getValue ();
140144 cldrMetaZone .put (Constants .TIMEZONENAME_METAZONE_EXEMPLARCITY , exemplarCity );
141145 cldrMetaZone .put (Constants .TIMEZONENAME_METAZONE_TIMEZONE , timeZone );
142- Iterator <JSONObject > metaiterator = mataZoneP .iterator ();
146+ Iterator <Object > metaiterator = mataZoneP .iterator ();
143147 List <Map <String , Object >> usesMetazones = new ArrayList <Map <String , Object >>();
144148 while (metaiterator .hasNext ()) {
145- JSONObject objZone = metaiterator .next ();
149+ JSONObject objZone = ( JSONObject ) metaiterator .next ();
146150 Map <String , Object > usesMetazoneMap = new TreeMap <String , Object >();
147151 String metazoneKey = (String ) select (objZone , "usesMetazone._mzone" );
148152 String _fromVal = (String ) select (objZone , "usesMetazone._from" );
0 commit comments