Author: mthl
Date: Thu Jun 27 19:39:22 2019 New Revision: 1862250 URL: http://svn.apache.org/viewvc?rev=1862250&view=rev Log: Improved: Add missing generics (OFBIZ-10966) Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java?rev=1862250&r1=1862249&r2=1862250&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java Thu Jun 27 19:39:22 2019 @@ -101,7 +101,7 @@ public class EntityJsonReader { public List<Object> getMessageList() { if (this.checkDataOnly && this.messageList == null) { - this.messageList = new LinkedList(); + this.messageList = new LinkedList<>(); } return this.messageList; @@ -154,7 +154,7 @@ public class EntityJsonReader { for (int jsonIndex = 0; jsonIndex < length; ++jsonIndex) { JSONObject jsonObject = jsonArray.getJSONObject(jsonIndex); - Iterator iterator = jsonObject.keySet().iterator(); + Iterator<?> iterator = jsonObject.keySet().iterator(); while (iterator.hasNext()) { String key = iterator.next().toString(); @@ -189,7 +189,7 @@ public class EntityJsonReader { } private static List<Map<String, Object>> iterateJsonEntityData(Object jsonData) { - List<Map<String, Object>> genericMapList = new LinkedList<Map<String, Object>>(); + List<Map<String, Object>> genericMapList = new LinkedList<>(); if (jsonData instanceof JSONArray) { JSONArray jsonArray = (JSONArray) jsonData; int length = jsonArray.length(); @@ -211,8 +211,8 @@ public class EntityJsonReader { } private static Map<String, Object> iterateJSONObject(JSONObject jsonObj) { - Map<String, Object> mapObj = new HashMap<String, Object>(); - Iterator iterator = jsonObj.keySet().iterator(); + Map<String, Object> mapObj = new HashMap<>(); + Iterator<?> iterator = jsonObj.keySet().iterator(); while (iterator.hasNext()) { String keyStr = (String) iterator.next(); Object keyvalue = jsonObj.get(keyStr); @@ -227,7 +227,7 @@ public class EntityJsonReader { } private long createUpdate(JSONObject jsonObject) throws IOException { - Iterator iterator = jsonObject.keySet().iterator(); + Iterator<?> iterator = jsonObject.keySet().iterator(); while (iterator.hasNext()) { String key = iterator.next().toString(); Object value = jsonObject.get(key); Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java?rev=1862250&r1=1862249&r2=1862250&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java Thu Jun 27 19:39:22 2019 @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRes import javax.servlet.http.HttpSession; import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.UtilGenerics; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; @@ -49,7 +50,7 @@ public class EntityJsonEvents { Security security = (Security) request.getAttribute("security"); boolean isFirst = true; if (security.hasPermission("ENTITY_MAINT", session)) { - TreeSet passedEntityNames = (TreeSet) session.getAttribute("jsonrawdump_entitylist"); + TreeSet<String> passedEntityNames = UtilGenerics.cast(session.getAttribute("jsonrawdump_entitylist")); session.removeAttribute("jsonrawdump_entitylist"); EntityExpr entityDateCond = (EntityExpr) session.getAttribute("entityDateCond"); session.removeAttribute("entityDateCond"); @@ -68,9 +69,9 @@ public class EntityJsonEvents { try { beganTransaction = TransactionUtil.begin(); - Iterator i = passedEntityNames.iterator(); + Iterator<String> i = passedEntityNames.iterator(); while (i.hasNext()) { - String curEntityName = (String) i.next(); + String curEntityName = i.next(); ModelEntity me = reader.getModelEntity(curEntityName); EntityListIterator values = null; |
Free forum by Nabble | Edit this page |