Skip to content

Commit

Permalink
Improved: Add missing generics
Browse files Browse the repository at this point in the history
(OFBIZ-10966)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862250 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 27, 2019
1 parent 698af7c commit 59599e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Expand Up @@ -101,7 +101,7 @@ public void setPlaceholderValues(Map<String, Object> placeholderValues) {


public List<Object> getMessageList() { public List<Object> getMessageList() {
if (this.checkDataOnly && this.messageList == null) { if (this.checkDataOnly && this.messageList == null) {
this.messageList = new LinkedList(); this.messageList = new LinkedList<>();
} }


return this.messageList; return this.messageList;
Expand Down Expand Up @@ -154,7 +154,7 @@ private long convertJsonAndWriteValues(String jsonString) throws IOException {


for (int jsonIndex = 0; jsonIndex < length; ++jsonIndex) { for (int jsonIndex = 0; jsonIndex < length; ++jsonIndex) {
JSONObject jsonObject = jsonArray.getJSONObject(jsonIndex); JSONObject jsonObject = jsonArray.getJSONObject(jsonIndex);
Iterator iterator = jsonObject.keySet().iterator(); Iterator<?> iterator = jsonObject.keySet().iterator();


while (iterator.hasNext()) { while (iterator.hasNext()) {
String key = iterator.next().toString(); String key = iterator.next().toString();
Expand Down Expand Up @@ -189,7 +189,7 @@ private long convertJsonAndWriteValues(String jsonString) throws IOException {
} }


private static List<Map<String, Object>> iterateJsonEntityData(Object jsonData) { 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) { if (jsonData instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) jsonData; JSONArray jsonArray = (JSONArray) jsonData;
int length = jsonArray.length(); int length = jsonArray.length();
Expand All @@ -211,8 +211,8 @@ private static List<Map<String, Object>> iterateJsonEntityData(Object jsonData)
} }


private static Map<String, Object> iterateJSONObject(JSONObject jsonObj) { private static Map<String, Object> iterateJSONObject(JSONObject jsonObj) {
Map<String, Object> mapObj = new HashMap<String, Object>(); Map<String, Object> mapObj = new HashMap<>();
Iterator iterator = jsonObj.keySet().iterator(); Iterator<?> iterator = jsonObj.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String keyStr = (String) iterator.next(); String keyStr = (String) iterator.next();
Object keyvalue = jsonObj.get(keyStr); Object keyvalue = jsonObj.get(keyStr);
Expand All @@ -227,7 +227,7 @@ private static Map<String, Object> iterateJSONObject(JSONObject jsonObj) {
} }


private long createUpdate(JSONObject jsonObject) throws IOException { private long createUpdate(JSONObject jsonObject) throws IOException {
Iterator iterator = jsonObject.keySet().iterator(); Iterator<?> iterator = jsonObject.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String key = iterator.next().toString(); String key = iterator.next().toString();
Object value = jsonObject.get(key); Object value = jsonObject.get(key);
Expand Down
Expand Up @@ -28,6 +28,7 @@
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;


import org.apache.ofbiz.base.util.Debug; 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.Delegator;
import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.GenericValue;
Expand All @@ -49,7 +50,7 @@ public static String downloadJsonData(HttpServletRequest request, HttpServletRes
Security security = (Security) request.getAttribute("security"); Security security = (Security) request.getAttribute("security");
boolean isFirst = true; boolean isFirst = true;
if (security.hasPermission("ENTITY_MAINT", session)) { 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"); session.removeAttribute("jsonrawdump_entitylist");
EntityExpr entityDateCond = (EntityExpr) session.getAttribute("entityDateCond"); EntityExpr entityDateCond = (EntityExpr) session.getAttribute("entityDateCond");
session.removeAttribute("entityDateCond"); session.removeAttribute("entityDateCond");
Expand All @@ -68,9 +69,9 @@ public static String downloadJsonData(HttpServletRequest request, HttpServletRes
try { try {
beganTransaction = TransactionUtil.begin(); beganTransaction = TransactionUtil.begin();


Iterator i = passedEntityNames.iterator(); Iterator<String> i = passedEntityNames.iterator();
while (i.hasNext()) { while (i.hasNext()) {
String curEntityName = (String) i.next(); String curEntityName = i.next();


ModelEntity me = reader.getModelEntity(curEntityName); ModelEntity me = reader.getModelEntity(curEntityName);
EntityListIterator values = null; EntityListIterator values = null;
Expand Down

0 comments on commit 59599e3

Please sign in to comment.