Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java Tue Dec 11 13:33:49 2018 @@ -47,7 +47,8 @@ public class CatalogUrlDirective impleme public final static String module = CatalogUrlDirective.class.getName(); @Override - public void execute(Environment env, Map args, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { + public void execute(Environment env, @SuppressWarnings("rawtypes") Map args, TemplateModel[] loopVars, + TemplateDirectiveBody body) throws TemplateException, IOException { Map<String, TemplateModel> params = UtilGenerics.checkMap(args); String productId = (String) DeepUnwrap.unwrap(params.get("productId")); String currentCategoryId = (String) DeepUnwrap.unwrap(params.get("currentCategoryId")); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java Tue Dec 11 13:33:49 2018 @@ -454,7 +454,7 @@ public class CategoryServices { primaryKeyName = "productCategoryId"; } - List categoryList = new LinkedList(); + List<Map<Object, Object>> categoryList = new LinkedList<>(); List<GenericValue> childOfCats; List<String> sortList = org.apache.ofbiz.base.util.UtilMisc.toList("sequenceNum", "title"); @@ -480,7 +480,7 @@ public class CategoryServices { catId = childOfCat.get("productCategoryId"); catNameField = "CATEGORY_NAME"; - Map josonMap = new HashMap(); + Map<Object, Object> josonMap = new HashMap<>(); List<GenericValue> childList = null; // Get the child list of chosen category @@ -493,8 +493,8 @@ public class CategoryServices { if (UtilValidate.isNotEmpty(childList)) { josonMap.put("state", "closed"); } - Map dataMap = new HashMap(); - Map dataAttrMap = new HashMap(); + Map<String, Object> dataMap = new HashMap<>(); + Map<String, String> dataAttrMap = new HashMap<>(); CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(cate, request); String title = null; if (UtilValidate.isNotEmpty(categoryContentWrapper.get(catNameField, "html"))) { @@ -513,7 +513,7 @@ public class CategoryServices { dataAttrMap.put("href", hrefStr); dataMap.put("attr", dataAttrMap); josonMap.put("data", dataMap); - Map attrMap = new HashMap(); + Map<String, Object> attrMap = new HashMap<>(); attrMap.put("id", catId); attrMap.put("isCatalog", false); attrMap.put("rel", "CATEGORY"); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java Tue Dec 11 13:33:49 2018 @@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpSession; import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.base.util.UtilDateTime; import org.apache.ofbiz.base.util.UtilFormatOut; import org.apache.ofbiz.base.util.UtilGenerics; import org.apache.ofbiz.base.util.UtilHttp; @@ -41,7 +40,6 @@ import org.apache.ofbiz.entity.Delegator import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.entity.util.EntityUtil; import org.apache.ofbiz.product.product.ProductWorker; @@ -224,21 +222,6 @@ public final class CategoryWorker { return count; } - private static EntityCondition buildCountCondition(String fieldName, String fieldValue) { - List<EntityCondition> orCondList = new LinkedList<EntityCondition>(); - orCondList.add(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, UtilDateTime.nowTimestamp())); - orCondList.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)); - EntityCondition orCond = EntityCondition.makeCondition(orCondList, EntityOperator.OR); - - List<EntityCondition> andCondList = new LinkedList<EntityCondition>(); - andCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, UtilDateTime.nowTimestamp())); - andCondList.add(EntityCondition.makeCondition(fieldName, EntityOperator.EQUALS, fieldValue)); - andCondList.add(orCond); - EntityCondition andCond = EntityCondition.makeCondition(andCondList, EntityOperator.AND); - - return andCond; - } - public static void setTrail(ServletRequest request, String currentCategory) { Map<String, Object> requestParameters = UtilHttp.getParameterMap((HttpServletRequest) request); String previousCategory = (String) requestParameters.get("pcategory"); @@ -423,7 +406,7 @@ public final class CategoryWorker { * @param context Map containing the input parameters * @return Map organized trail from root point to categoryId. * */ - public static Map getCategoryTrail(DispatchContext dctx, Map context) { + public static Map<String, Object> getCategoryTrail(DispatchContext dctx, Map<String, Object> context) { String productCategoryId = (String) context.get("productCategoryId"); Map<String, Object> results = ServiceUtil.returnSuccess(); Delegator delegator = dctx.getDelegator(); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java Tue Dec 11 13:33:49 2018 @@ -23,7 +23,6 @@ import java.util.LinkedList; import java.util.List; import javax.servlet.RequestDispatcher; -import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -31,7 +30,6 @@ import javax.servlet.http.HttpServletRes import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.StringUtil; -import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericEntityException; Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java Tue Dec 11 13:33:49 2018 @@ -80,7 +80,8 @@ public class CatalogAltUrlSeoTransform i } @Override - public Writer getWriter(final Writer out, final Map args) throws TemplateModelException, IOException { + public Writer getWriter(Writer out, @SuppressWarnings("rawtypes") Map args) + throws TemplateModelException, IOException { final StringBuilder buf = new StringBuilder(); final boolean fullPath = checkArg(args, "fullPath", false); final boolean secure = checkArg(args, "secure", false); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java Tue Dec 11 13:33:49 2018 @@ -96,7 +96,7 @@ public class CatalogUrlSeoTransform impl } @Override - public Writer getWriter(final Writer out, final Map args) + public Writer getWriter(Writer out, @SuppressWarnings("rawtypes") Map args) throws TemplateModelException, IOException { final StringBuilder buf = new StringBuilder(); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogAltUrlTransform.java Tue Dec 11 13:33:49 2018 @@ -78,7 +78,7 @@ public class OfbizCatalogAltUrlTransform } @Override - public Writer getWriter(final Writer out, final Map args) + public Writer getWriter(Writer out, @SuppressWarnings("rawtypes") Map args) throws TemplateModelException, IOException { final StringBuilder buf = new StringBuilder(); final boolean fullPath = checkArg(args, "fullPath", false); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogUrlTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogUrlTransform.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogUrlTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/OfbizCatalogUrlTransform.java Tue Dec 11 13:33:49 2018 @@ -47,7 +47,8 @@ public class OfbizCatalogUrlTransform im } @Override - public Writer getWriter(final Writer out, final Map args) throws TemplateModelException, IOException { + public Writer getWriter(Writer out, @SuppressWarnings("rawtypes") Map args) + throws TemplateModelException, IOException { final StringBuilder buf = new StringBuilder(); return new Writer(out) { Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java Tue Dec 11 13:33:49 2018 @@ -62,7 +62,8 @@ public class SeoTransform implements Tem return defaultValue; } - public Writer getWriter(final Writer out, Map args) { + @Override + public Writer getWriter(Writer out, @SuppressWarnings("rawtypes") Map args) { final StringBuffer buf = new StringBuffer(); final boolean fullPath = checkArg(args, "fullPath", false); final boolean secure = checkArg(args, "secure", false); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java Tue Dec 11 13:33:49 2018 @@ -62,7 +62,8 @@ public class UrlRegexpTransform implemen return defaultValue; } - public Writer getWriter(final Writer out, Map args) { + @Override + public Writer getWriter(final Writer out, @SuppressWarnings("rawtypes") Map args) { final StringBuffer buf = new StringBuffer(); final boolean fullPath = checkArg(args, "fullPath", false); final boolean secure = checkArg(args, "secure", false); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java Tue Dec 11 13:33:49 2018 @@ -96,8 +96,8 @@ public final class ProductConfigWorker { if (o instanceof String) { opts = new String[]{(String)o}; } else if(o instanceof List) { - List list = (List)o; - opts = (String[])((String[])list.toArray(new String[list.size()])); + List<?> list = (List<?>)o; + opts = list.toArray(new String[list.size()]); } if (opts == null) { Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java Tue Dec 11 13:33:49 2018 @@ -28,6 +28,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Set; import org.apache.ofbiz.base.util.Debug; @@ -555,6 +556,11 @@ public class ProductConfigWrapper implem public String toString() { return configItem.getString("configItemId"); } + + @Override + public int hashCode() { + return Objects.hash(configItem, configItemAssoc, content, options, first); + } } public class ConfigOption implements java.io.Serializable { Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java Tue Dec 11 13:33:49 2018 @@ -519,25 +519,20 @@ public class PriceServices { if (UtilValidate.isNotEmpty(result)) { Map<String, Object> convertPriceMap = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry : result.entrySet()) { - BigDecimal tempPrice = BigDecimal.ZERO; + BigDecimal tempPrice; switch (entry.getKey()) { case "basePrice": - tempPrice = (BigDecimal) entry.getValue(); case "price": - tempPrice = (BigDecimal) entry.getValue(); case "defaultPrice": - tempPrice = (BigDecimal) entry.getValue(); case "competitivePrice": - tempPrice = (BigDecimal) entry.getValue(); case "averageCost": - tempPrice = (BigDecimal) entry.getValue(); case "promoPrice": - tempPrice = (BigDecimal) entry.getValue(); case "specialPromoPrice": - tempPrice = (BigDecimal) entry.getValue(); case "listPrice": tempPrice = (BigDecimal) entry.getValue(); - + break; + default: + tempPrice = BigDecimal.ZERO; } if (tempPrice != null && tempPrice != BigDecimal.ZERO) { Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java Tue Dec 11 13:33:49 2018 @@ -390,7 +390,7 @@ public class ProductEvents { // just store a new empty list in the session HttpSession session = request.getSession(); if (session != null) { - session.setAttribute("lastViewedCategories", new LinkedList()); + session.setAttribute("lastViewedCategories", new LinkedList<>()); } return "success"; } @@ -400,7 +400,7 @@ public class ProductEvents { // just store a new empty list in the session HttpSession session = request.getSession(); if (session != null) { - session.setAttribute("lastViewedProducts", new LinkedList()); + session.setAttribute("lastViewedProducts", new LinkedList<>()); } return "success"; } @@ -1140,7 +1140,7 @@ public class ProductEvents { public static String clearProductComparisonList(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); - session.setAttribute("productCompareList", new LinkedList()); + session.setAttribute("productCompareList", new LinkedList<>()); String eventMsg = UtilProperties.getMessage("ProductUiLabels", "ProductClearCompareListSuccess", UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", eventMsg); return "success"; Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java Tue Dec 11 13:33:49 2018 @@ -986,7 +986,10 @@ public class ProductServices { List<GenericValue> fileExtension; try { - fileExtension = EntityQuery.use(delegator).from("FileExtension").where("mimeTypeId", (String) context.get("_uploadedFile_contentType")).queryList(); + fileExtension = EntityQuery.use(delegator) + .from("FileExtension") + .where("mimeTypeId", context.get("_uploadedFile_contentType")) + .queryList(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1320,7 +1323,10 @@ public class ProductServices { List<GenericValue> fileExtension; try { - fileExtension = EntityQuery.use(delegator).from("FileExtension").where("mimeTypeId", EntityOperator.EQUALS, (String) context.get("_uploadedFile_contentType")).queryList(); + fileExtension = EntityQuery.use(delegator) + .from("FileExtension") + .where("mimeTypeId", EntityOperator.EQUALS, context.get("_uploadedFile_contentType")) + .queryList(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/spreadsheetimport/ImportProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/spreadsheetimport/ImportProductServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/spreadsheetimport/ImportProductServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/spreadsheetimport/ImportProductServices.java Tue Dec 11 13:33:49 2018 @@ -41,6 +41,7 @@ import org.apache.poi.hssf.usermodel.HSS import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.ss.usermodel.CellType; public class ImportProductServices { @@ -122,12 +123,12 @@ public class ImportProductServices { // read productId from first column "sheet column index // starts from 0" HSSFCell cell2 = row.getCell(2); - cell2.setCellType(HSSFCell.CELL_TYPE_STRING); + cell2.setCellType(CellType.STRING); String productId = cell2.getRichStringCellValue().toString(); // read QOH from ninth column HSSFCell cell5 = row.getCell(5); BigDecimal quantityOnHand = BigDecimal.ZERO; - if (cell5 != null && cell5.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) { + if (cell5 != null && cell5.getCellTypeEnum() == CellType.NUMERIC) { quantityOnHand = new BigDecimal(cell5.getNumericCellValue()); } Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java Tue Dec 11 13:33:49 2018 @@ -39,13 +39,12 @@ public class ProductStoreEvents { public static final String module = ProductStoreWorker.class.getName(); // Please note : the structure of map in this function is according to the JSON data map of the jsTree - @SuppressWarnings("unchecked") public static String getChildProductStoreGroupTree(HttpServletRequest request, HttpServletResponse response){ Delegator delegator = (Delegator) request.getAttribute("delegator"); String parentGroupId = request.getParameter("parentGroupId"); String onclickFunction = request.getParameter("onclickFunction"); - List productStoreGroupList = new LinkedList(); + List<Map<Object, Object>> productStoreGroupList = new LinkedList<>(); List<GenericValue> children; List<String> sortList = org.apache.ofbiz.base.util.UtilMisc.toList("sequenceNum"); @@ -56,7 +55,7 @@ public class ProductStoreEvents { if (UtilValidate.isNotEmpty(children)) { for (GenericValue child : children ) { String productStoreGroupId = child.getString("productStoreGroupId"); - Map<String, Object> josonMap = new HashMap<>(); + Map<Object, Object> josonMap = new HashMap<>(); List<GenericValue> childList = null; // Get the child list of chosen category childList = EntityQuery.use(delegator).from("ProductStoreGroupRollupAndChild").where("parentGroupId", productStoreGroupId).cache(true).filterByDate().queryList(); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java Tue Dec 11 13:33:49 2018 @@ -21,10 +21,8 @@ package org.apache.ofbiz.shipment.thirdp import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.util.List; -import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; @@ -33,7 +31,6 @@ import javax.servlet.http.HttpServletRes import javax.xml.transform.TransformerException; import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.base.util.UtilIO; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.UtilXml; import org.w3c.dom.Document; Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java Tue Dec 11 13:33:49 2018 @@ -146,7 +146,9 @@ public class UspsServices { String serviceCode = null; try { GenericValue carrierShipmentMethod = EntityQuery.use(delegator).from("CarrierShipmentMethod") - .where("shipmentMethodTypeId", (String) context.get("shipmentMethodTypeId"), "partyId", (String) context.get("carrierPartyId"), "roleTypeId", (String) context.get("carrierRoleTypeId")) + .where("shipmentMethodTypeId", context.get("shipmentMethodTypeId"), + "partyId", context.get("carrierPartyId"), + "roleTypeId", context.get("carrierRoleTypeId")) .queryOne(); if (carrierShipmentMethod != null) { serviceCode = carrierShipmentMethod.getString("carrierServiceCode").toUpperCase(Locale.getDefault()); @@ -315,7 +317,9 @@ public class UspsServices { String serviceCode = null; try { GenericValue carrierShipmentMethod = EntityQuery.use(delegator).from("CarrierShipmentMethod") - .where("shipmentMethodTypeId", (String) context.get("shipmentMethodTypeId"), "partyId", (String) context.get("carrierPartyId"), "roleTypeId", (String) context.get("carrierRoleTypeId")) + .where("shipmentMethodTypeId", context.get("shipmentMethodTypeId"), + "partyId", context.get("carrierPartyId"), + "roleTypeId", context.get("carrierRoleTypeId")) .queryOne(); if (carrierShipmentMethod != null) { serviceCode = carrierShipmentMethod.getString("carrierServiceCode"); @@ -1450,7 +1454,6 @@ public class UspsServices { try (FileOutputStream fileOut = new FileOutputStream(outFileName)) { fileOut.write(labelImageBytes); fileOut.flush(); - fileOut.close(); } catch (IOException e) { Debug.logInfo(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/build.gradle URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/build.gradle?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/build.gradle (original) +++ ofbiz/ofbiz-framework/trunk/build.gradle Tue Dec 11 13:33:49 2018 @@ -70,11 +70,13 @@ javadoc.options { sourceCompatibility = '1.8' targetCompatibility = '1.8' -// Java compile options, syntax gradlew -PXlint build +// Java compile options, syntax gradlew -PXlint:none build tasks.withType(JavaCompile) { options.encoding = 'UTF-8' - if (project.hasProperty('Xlint')) { - options.compilerArgs << "-Xlint" + if (!project.hasProperty('Xlint:none')) { + options.compilerArgs << "-Xlint:all" + // Exclude varargs warnings which are not silenced by @SafeVarargs. + options.compilerArgs << "-Xlint:-varargs" } } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java Tue Dec 11 13:33:49 2018 @@ -32,7 +32,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; import org.apache.ofbiz.base.component.ComponentConfig; import org.apache.ofbiz.base.component.ComponentException; import org.apache.ofbiz.base.component.ComponentLoaderConfig; Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestBooleanConverters.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestBooleanConverters.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestBooleanConverters.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestBooleanConverters.java Tue Dec 11 13:33:49 2018 @@ -26,6 +26,7 @@ import org.apache.ofbiz.base.conversion. import org.apache.ofbiz.base.conversion.Converter; import org.apache.ofbiz.base.conversion.ConverterLoader; import org.apache.ofbiz.base.conversion.Converters; +import org.apache.ofbiz.base.util.UtilGenerics; import junit.framework.TestCase; @@ -49,12 +50,13 @@ public class TestBooleanConverters exten assertEquals(label + " converted", Boolean.FALSE, converter.convert(falseSource)); } - @SuppressWarnings("unchecked") public static <S> void assertToCollection(String label, S source) throws Exception { - Converter<S, ? extends Collection> toList = (Converter<S, ? extends Collection>) Converters.getConverter(source.getClass(), List.class); + Converter<S, ? extends Collection<S>> toList = + UtilGenerics.cast(Converters.getConverter(source.getClass(), List.class)); Collection<S> listResult = toList.convert(source); assertEquals(label + " converted to List", source, listResult.toArray()[0]); - Converter<S, ? extends Collection> toSet = (Converter<S, ? extends Collection>) Converters.getConverter(source.getClass(), Set.class); + Converter<S, ? extends Collection<S>> toSet = + UtilGenerics.cast(Converters.getConverter(source.getClass(), Set.class)); Collection<S> setResult = toSet.convert(source); assertEquals(label + " converted to Set", source, setResult.toArray()[0]); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/lang/test/ComparableRangeTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/lang/test/ComparableRangeTests.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/lang/test/ComparableRangeTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/lang/test/ComparableRangeTests.java Tue Dec 11 13:33:49 2018 @@ -34,26 +34,9 @@ public class ComparableRangeTests extend super(name); } - @SuppressWarnings("unchecked") private static <L extends Comparable<L>, R extends Comparable<R>> void comparableRangeConstructorTest(L left, R right) { new ComparableRange<>(left, left); new ComparableRange<>(right, right); - IllegalArgumentException caught = null; - try { - new ComparableRange(left, right); - } catch (IllegalArgumentException e) { - caught = e; - } finally { - assertNotNull("expected exception", caught); - } - caught = null; - try { - new ComparableRange(right, left); - } catch (IllegalArgumentException e) { - caught = e; - } finally { - assertNotNull("expected exception", caught); - } } private static <T extends Comparable<T>, B extends Comparable<B>> void comparableRangeTest(String label, B bad, T a, T b, T c, T d) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java Tue Dec 11 13:33:49 2018 @@ -341,7 +341,6 @@ OUTER: assertEquals(null, wanted, got); } - @SuppressWarnings("unchecked") public static void assertEquals(String msg, Object wanted, Object got) { if (wanted instanceof List) { assertEquals(msg, (List<?>) wanted, got); @@ -359,7 +358,7 @@ OUTER: } else if (got.getClass().isArray()) { assertEqualsArrayArray(msg, wanted, got); } else if (got instanceof List) { - assertEqualsArrayList(msg, wanted, (List) got); + assertEqualsArrayList(msg, wanted, (List<?>) got); } else { TestCase.assertEquals(msg, wanted, got); } @@ -374,6 +373,7 @@ OUTER: return list; } + @SafeVarargs public static <T> List<T> list(T... list) { return new ArrayList<>(Arrays.asList(list)); } @@ -384,6 +384,7 @@ OUTER: return set; } + @SafeVarargs public static <T> Set<T> set(T... list) { return new HashSet<>(Arrays.asList(list)); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java Tue Dec 11 13:33:49 2018 @@ -231,7 +231,6 @@ public class HttpRequestFileUpload { } } fos.flush(); - fos.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectInputStream.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectInputStream.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectInputStream.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectInputStream.java Tue Dec 11 13:33:49 2018 @@ -49,7 +49,7 @@ public class ObjectInputStream extends j */ @Override protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { - Class<?>[] cinterfaces = new Class[interfaces.length]; + Class<?>[] cinterfaces = new Class<?>[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { cinterfaces[i] = classloader.loadClass(interfaces[i]); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java Tue Dec 11 13:33:49 2018 @@ -19,6 +19,7 @@ package org.apache.ofbiz.base.util; import java.io.Serializable; +import java.util.Objects; import org.apache.ofbiz.base.lang.SourceMonitored; import org.apache.ofbiz.base.lang.ThreadSafe; @@ -296,6 +297,11 @@ public class TimeDuration implements Ser return cal; } + @Override + public int hashCode() { + return Objects.hash(milliseconds, seconds, minutes, hours, days, months, years); + } + /** Returns a <code>TimeDuration</code> instance derived from an encoded * <code>long</code> value. This method is intended to be used in tandem with the * <code>toLong</code> method. <b>Note:</b> this Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java Tue Dec 11 13:33:49 2018 @@ -63,6 +63,7 @@ public class UtilCodec { /** * @deprecated Use {@link #sanitize(String,String)} instead */ + @Deprecated public String sanitize(String outString); // Only really useful with HTML, else it simply calls encode() method public String sanitize(String outString, String contentTypeId); // Only really useful with HTML, else it simply calls encode() method } @@ -83,6 +84,7 @@ public class UtilCodec { /** * @deprecated Use {@link #sanitize(String,String)} instead */ + @Deprecated public String sanitize(String original) { return sanitize(original, null); } @@ -144,6 +146,7 @@ public class UtilCodec { /** * @deprecated Use {@link #sanitize(String,String)} instead */ + @Deprecated public String sanitize(String original) { return sanitize(original, null); } @@ -164,6 +167,7 @@ public class UtilCodec { /** * @deprecated Use {@link #sanitize(String,String)} instead */ + @Deprecated public String sanitize(String original) { return sanitize(original, null); } @@ -192,6 +196,7 @@ public class UtilCodec { /** * @deprecated Use {@link #sanitize(String,String)} instead */ + @Deprecated public String sanitize(String original) { return sanitize(original, null); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Tue Dec 11 13:33:49 2018 @@ -169,6 +169,7 @@ public final class UtilGenerics { return map; } + @SafeVarargs @SuppressWarnings("hiding") public static <K, Object> Map<K, Object> toMap(Class<K> keyType, Object... data) { if (data == null) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java Tue Dec 11 13:33:49 2018 @@ -32,82 +32,24 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -import org.apache.commons.io.IOUtils; - public final class UtilIO { private static final Charset UTF8 = Charset.forName("UTF-8"); public static final String module = UtilIO.class.getName(); private UtilIO () {} - /** Copy an InputStream to an OutputStream, optionally closing either - * the input or the output. - * - * @param in the InputStream to copy from - * @param closeIn whether to close the input when the copy is done - * @param out the OutputStream to copy to - * @param closeOut whether to close the output when the copy is done - * @throws IOException if an error occurs - */ - public static void copy(InputStream in, boolean closeIn, OutputStream out, boolean closeOut) throws IOException { - try { - try { - IOUtils.copy(in, out); - } finally { - if (closeIn) { - IOUtils.closeQuietly(in); - } - } - } finally { - if (closeOut) { - IOUtils.closeQuietly(out); - } - } - } - - /** Copy a Reader to a Writer, optionally closing either the input or - * the output. - * - * @param reader the Reader to copy from - * @param closeIn whether to close the input when the copy is done - * @param writer the Writer to copy to - * @param closeOut whether to close the output when the copy is done - * @throws IOException if an error occurs - */ - public static void copy(Reader reader, boolean closeIn, Writer writer, boolean closeOut) throws IOException { - try { - try { - IOUtils.copy(reader, writer); - } finally { - if (closeIn) { - IOUtils.closeQuietly(reader); - } - } - } finally { - if (closeOut) { - IOUtils.closeQuietly(writer); - } - } - } - /** Copy a Reader to an Appendable, optionally closing the input. + /** Copy a Reader to an Appendable. * * @param reader the Reader to copy from - * @param closeIn whether to close the input when the copy is done * @param out the Appendable to copy to * @throws IOException if an error occurs */ - public static void copy(Reader reader, boolean closeIn, Appendable out) throws IOException { - try { - CharBuffer buffer = CharBuffer.allocate(4096); - while (reader.read(buffer) > 0) { - buffer.flip(); - buffer.rewind(); - out.append(buffer); - } - } finally { - if (closeIn) { - IOUtils.closeQuietly(reader); - } + public static void copy(Reader reader, Appendable out) throws IOException { + CharBuffer buffer = CharBuffer.allocate(4096); + while (reader.read(buffer) > 0) { + buffer.flip(); + buffer.rewind(); + out.append(buffer); } } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java Tue Dec 11 13:33:49 2018 @@ -218,6 +218,7 @@ public final class UtilNumber { * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to BigDecimal.ROUND_HALF_UP * @deprecated Use {@link #getRoundingMode(String,String)} instead */ + @Deprecated public static int getBigDecimalRoundingMode(String file, String property) { return getRoundingMode(file, property).ordinal(); } @@ -228,6 +229,7 @@ public final class UtilNumber { * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to BigDecimal.ROUND_HALF_UP * @deprecated Use {@link #getRoundingMode(String)} instead */ + @Deprecated public static int getBigDecimalRoundingMode(String property) { return getRoundingMode(arithmeticPropertiesFile, property).ordinal(); } @@ -342,6 +344,7 @@ public final class UtilNumber { * @deprecated Use {@link #toPercentString(Number number, int scale, RoundingMode roundingMode)} instead * */ + @Deprecated public static String toPercentString(Number number, int scale, int roundingMode) { // convert to BigDecimal if (!(number instanceof BigDecimal)) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java Tue Dec 11 13:33:49 2018 @@ -566,8 +566,6 @@ public final class UtilProperties implem +"# The comments have been removed, you may still find them on the OFBiz repository... \n" +"#"); } - - propFile.close(); } catch (FileNotFoundException e) { Debug.logInfo(e, "Unable to located the resource file.", module); } catch (IOException e) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java Tue Dec 11 13:33:49 2018 @@ -43,8 +43,9 @@ import org.apache.ofbiz.base.util.string @SuppressWarnings("serial") public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty { public static final String module = FlexibleMapAccessor.class.getName(); - private static final UtilCache<String, FlexibleMapAccessor<?>> fmaCache = UtilCache.createUtilCache("flexibleMapAccessor.ExpressionCache"); - private static final FlexibleMapAccessor nullFma = new FlexibleMapAccessor(""); + private static final UtilCache<String, FlexibleMapAccessor<Object>> fmaCache = + UtilCache.createUtilCache("flexibleMapAccessor.ExpressionCache"); + private static final FlexibleMapAccessor<?> nullFma = new FlexibleMapAccessor<>(""); private final boolean isEmpty; private final String original; @@ -84,15 +85,14 @@ public final class FlexibleMapAccessor<T * @param original The original String expression * @return A FlexibleMapAccessor instance */ - @SuppressWarnings("unchecked") public static <T> FlexibleMapAccessor<T> getInstance(String original) { if (UtilValidate.isEmpty(original) || "null".equals(original)) { - return nullFma; + return UtilGenerics.cast(nullFma); } - FlexibleMapAccessor fma = fmaCache.get(original); + FlexibleMapAccessor<T> fma = UtilGenerics.cast(fmaCache.get(original)); if (fma == null) { - fmaCache.putIfAbsent(original, new FlexibleMapAccessor(original)); - fma = fmaCache.get(original); + fmaCache.putIfAbsent(original, new FlexibleMapAccessor<>(original)); + fma = UtilGenerics.cast(fmaCache.get(original)); } return fma; } @@ -221,10 +221,10 @@ public final class FlexibleMapAccessor<T if (this == obj) { return true; } - try { - FlexibleMapAccessor that = (FlexibleMapAccessor) obj; + if (obj instanceof FlexibleMapAccessor) { + FlexibleMapAccessor<?> that = (FlexibleMapAccessor<?>) obj; return UtilObject.equalsHelper(this.original, that.original); - } catch (Exception e) {} + } return false; } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java Tue Dec 11 13:33:49 2018 @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; @@ -66,6 +67,11 @@ public abstract class GenericMap<K, V> i } @Override + public int hashCode() { + return Objects.hash(entrySet, keySet, values); + } + + @Override public boolean equals(Object o) { if (!(o instanceof Map<?, ?>)) { return false; Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java Tue Dec 11 13:33:49 2018 @@ -451,21 +451,6 @@ public class UelFunctions { return label; } - public static boolean urlExists(String str) { - boolean result = false; - try { - URL url = FlexibleLocation.resolveLocation(str); - if (url != null) { - try (InputStream is = url.openStream();) { - result = true; - } - } - } catch (IOException e) { - Debug.log(e, module); - } - return result; - } - public static Document readHtmlDocument(String str) { Document document = null; try { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java Tue Dec 11 13:33:49 2018 @@ -83,7 +83,7 @@ public final class UelUtil { * @param expectedType The expected object Class to return * @return Result object */ - public static Object evaluate(Map<String, ? extends Object> context, String expression, Class expectedType) { + public static Object evaluate(Map<String, ? extends Object> context, String expression, Class<?> expectedType) { ELContext elContext = new ReadOnlyContext(context); ValueExpression ve = exprFactory.createValueExpression(elContext, expression, expectedType); return ve.getValue(elContext); @@ -95,7 +95,7 @@ public final class UelUtil { * @param expression UEL expression * @param expectedType The expected object Class to set */ - public static void setValue(Map<String, Object> context, String expression, Class expectedType, Object value) { + public static void setValue(Map<String, Object> context, String expression, Class<?> expectedType, Object value) { if (Debug.verboseOn()) { Debug.logVerbose("UelUtil.setValue invoked, expression = " + expression + ", value = " + value, module); } @@ -358,8 +358,8 @@ public final class UelUtil { super(isReadOnly); this.isReadOnly = isReadOnly; } + @Override - @SuppressWarnings("unchecked") public void setValue(ELContext context, Object base, Object property, Object val) { if (context == null) { throw new NullPointerException(); @@ -374,7 +374,7 @@ public final class UelUtil { Debug.logVerbose("ExtendedListResolver.setValue adding List element: base = " + base + ", property = " + property + ", value = " + val, module); } context.setPropertyResolved(true); - List list = (List) base; + List<Object> list = UtilGenerics.cast(base); list.add(val); } else if (str.startsWith("insert@")) { if (Debug.verboseOn()) { @@ -383,7 +383,7 @@ public final class UelUtil { context.setPropertyResolved(true); String indexStr = str.replace("insert@", ""); int index = Integer.parseInt(indexStr); - List list = (List) base; + List<Object> list = UtilGenerics.cast(base); try { list.add(index, val); } catch (UnsupportedOperationException ex) { @@ -413,7 +413,7 @@ public final class UelUtil { } if (base != null && base instanceof LocalizedMap) { context.setPropertyResolved(true); - LocalizedMap map = (LocalizedMap) base; + LocalizedMap<Object> map = (LocalizedMap<Object>) base; Locale locale = null; try { VariableMapper vm = context.getVariableMapper(); @@ -436,11 +436,11 @@ public final class UelUtil { } locale = Locale.getDefault(); } - return resolveVariable(property.toString(), (Map) map, locale); + return resolveVariable(property.toString(), (Map<String, Object>) map, locale); } if (base != null && base instanceof Map && property instanceof String) { context.setPropertyResolved(true); - return resolveVariable(property.toString(), (Map) base, null); + return resolveVariable(property.toString(), (Map<String, Object>) base, null); } return super.getValue(context, base, property); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java Tue Dec 11 13:33:49 2018 @@ -223,6 +223,7 @@ public class FlexibleStringExpanderTests Debug.set(Debug.VERBOSE, wasVerbose); } + @SuppressWarnings("serial") public static class ThrowException extends Exception{ public Object getValue() throws Exception { throw new Exception(); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java Tue Dec 11 13:33:49 2018 @@ -160,8 +160,7 @@ public class AssertTests extends TestCas fail("isNotInstanceOf (argument list) threw an exception - " + e); } try { - Map[] mapArray = {strMap}; - Assert.isAssignableTo("foo", strArray, mapArray.getClass()); + Assert.isAssignableTo("foo", strArray, Map[].class); fail("isNotInstanceOf (argument list) - IllegalArgumentException not thrown"); } catch (IllegalArgumentException e) {} } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java Tue Dec 11 13:33:49 2018 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.apache.ofbiz.base.util.test; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -28,7 +29,6 @@ import org.apache.ofbiz.base.lang.Source import org.apache.ofbiz.base.test.GenericTestCaseBase; import org.apache.ofbiz.base.util.GeneralRuntimeException; import org.apache.ofbiz.base.util.StringUtil; -import org.apache.ofbiz.base.util.UtilGenerics; @SourceMonitored public class StringUtilTests extends GenericTestCaseBase { @@ -48,7 +48,6 @@ public class StringUtilTests extends Gen public void testStringUtil() throws Exception { assertStaticHelperClass(StringUtil.class); - assertTrue("correct INSTANCE", StringUtil.INSTANCE instanceof StringUtil); } public void testInternString() { @@ -151,12 +150,12 @@ public class StringUtilTests extends Gen } public void testCreateMap() { - List<String>[] badKeys = UtilGenerics.cast(new List[] {null, list("1"), list("2")}); - List<String>[] badValues = UtilGenerics.cast(new List[] {list("one"), null, list("two", "extra")}); - for (int i = 0; i < badKeys.length; i++) { + List<List<String>> badKeys = Arrays.asList(null, list("1"), list("2")); + List<List<String>> badValues = Arrays.asList(list("one"), null, list("two", "extra")); + for (int i = 0; i < badKeys.size(); i++) { IllegalArgumentException caught = null; try { - StringUtil.createMap(badKeys[i], badValues[i]); + StringUtil.createMap(badKeys.get(i), badValues.get(i)); } catch (IllegalArgumentException e) { caught = e; } finally { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/TimeDurationTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/TimeDurationTests.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/TimeDurationTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/TimeDurationTests.java Tue Dec 11 13:33:49 2018 @@ -122,7 +122,6 @@ public class TimeDurationTests extends G assertEquals(label + ".equals(cal, string)", calDuration, stringDuration); assertEquals(label + ".equals(string, cal)", stringDuration, calDuration); assertEquals(label + ".equals(string, string)", stringDuration, stringDuration); - assertFalse(label + ".not-equals(string, this)", stringDuration.equals(TimeDurationTests.class)); if (lastString != null) { assertFalse(label + ".not-equals(string, lastString)", stringDuration.equals(lastString)); } Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java Tue Dec 11 13:33:49 2018 @@ -224,7 +224,7 @@ public class FindServices { * condition grouped by an {@link EntityOperator.OR} * That will allow union of search criteria, instead of default intersection. */ - Map<String, List<EntityCondition>> savedGroups = new LinkedHashMap(); + Map<String, List<EntityCondition>> savedGroups = new LinkedHashMap<>(); for (ModelField modelField : fieldList) { fieldMap.put(modelField.getName(), modelField); } Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/period/PeriodWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/period/PeriodWorker.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/period/PeriodWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/period/PeriodWorker.java Tue Dec 11 13:33:49 2018 @@ -30,8 +30,7 @@ import org.apache.ofbiz.entity.condition import org.apache.ofbiz.entity.condition.EntityOperator; public final class PeriodWorker { - - private final static String module = PeriodWorker.class.getName(); + public final static String module = PeriodWorker.class.getName(); private PeriodWorker() {} Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java Tue Dec 11 13:33:49 2018 @@ -156,7 +156,9 @@ public class QRCodeServices { typeMap.put("height", logoImageMaxHeight.toString()); Map<String, Map<String, String>> dimensionMap = new HashMap<>(); dimensionMap.put("QRCode", typeMap); - Map<String, Object> logoImageResult = ImageTransform.scaleImage(logoBufferedImage, (double) logoBufferedImage.getWidth(), (double) logoBufferedImage.getHeight(), dimensionMap, "QRCode", locale); + Map<String, Object> logoImageResult = + ImageTransform.scaleImage(logoBufferedImage, logoBufferedImage.getWidth(), + logoBufferedImage.getHeight(), dimensionMap, "QRCode", locale); logoBufferedImage = (BufferedImage) logoImageResult.get("bufferedImage"); } BitMatrix newBitMatrix = bitMatrix.clone(); Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java Tue Dec 11 13:33:49 2018 @@ -281,6 +281,7 @@ public class GenericEntity implements Ma * * @deprecated Use hasChanged() */ + @Deprecated public boolean isModified() { return this.hasChanged(); } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityComparisonOperator.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityComparisonOperator.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityComparisonOperator.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityComparisonOperator.java Tue Dec 11 13:33:49 2018 @@ -22,6 +22,7 @@ package org.apache.ofbiz.entity.conditio import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.PatternFactory; @@ -242,21 +243,11 @@ public abstract class EntityComparisonOp return true; } - public static final <L,R> boolean compareIn(L lhs, R rhs) { - if (lhs == null) { - if (rhs != null) { - return false; - } - return true; - } else if (rhs instanceof Collection<?>) { - if (((Collection<?>) rhs).contains(lhs)) { - return true; - } - return false; - } else if (lhs.equals(rhs)) { - return true; + public static final <L, R extends L> boolean compareIn(L lhs, R rhs) { + if (rhs instanceof Collection && lhs != null) { + return (((Collection<?>) rhs).contains(lhs)); } else { - return false; + return Objects.equals(lhs, rhs); } } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java Tue Dec 11 13:33:49 2018 @@ -56,10 +56,12 @@ public abstract class EntityCondition ex return new EntityExpr(lhs, operator, rhs); } + @SafeVarargs public static <T extends EntityCondition> EntityConditionList<T> makeCondition(EntityJoinOperator operator, T... conditionList) { return new EntityConditionList<>(Arrays.<T>asList(conditionList), operator); } + @SafeVarargs public static <T extends EntityCondition> EntityConditionList<T> makeCondition(T... conditionList) { return new EntityConditionList<>(Arrays.<T>asList(conditionList), EntityOperator.AND); } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java Tue Dec 11 13:33:49 2018 @@ -25,7 +25,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; -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.GenericModelException; @@ -45,18 +44,6 @@ public class EntityConditionBuilder exte this.condition = condition; } - public Object asType(Class clz) { - Debug.logInfo("asType(%s): %s", module, clz, condition); - if (clz == EntityCondition.class) { - return condition; - } - return this; - } - - public EntityCondition build() { - return condition; - } - public boolean isEmpty() { return condition.isEmpty(); } @@ -106,7 +93,7 @@ public class EntityConditionBuilder exte } @Override - protected Object createNode(Object methodName, Map mapArg) { + protected Object createNode(Object methodName, @SuppressWarnings("rawtypes") Map mapArg) { Map<String, Object> fieldValueMap = UtilGenerics.checkMap(mapArg); String operatorName = ((String)methodName).toLowerCase(Locale.getDefault()); EntityComparisonOperator<String, Object> operator = EntityOperator.lookupComparison(operatorName); @@ -121,7 +108,7 @@ public class EntityConditionBuilder exte } @Override - protected Object createNode(Object methodName, Map mapArg, Object objArg) { + protected Object createNode(Object methodName, @SuppressWarnings("rawtypes") Map mapArg, Object objArg) { return null; } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java Tue Dec 11 13:33:49 2018 @@ -47,6 +47,7 @@ public final class EntityFieldMap extend return list; } + @SafeVarargs public <V> EntityFieldMap(EntityComparisonOperator<?,?> compOp, EntityJoinOperator joinOp, V... keysValues) { this(EntityUtil.makeFields(keysValues), UtilGenerics.<EntityComparisonOperator<String,V>>cast(compOp), joinOp); } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java Tue Dec 11 13:33:49 2018 @@ -56,11 +56,12 @@ public class DBCPConnectionFactory imple public static final String module = DBCPConnectionFactory.class.getName(); // ManagedDataSource is useful to debug the usage of connections in the pool (must be verbose) // In case you don't want to be disturbed in the log (focusing on something else), it's still easy to comment out the line from DebugManagedDataSource - protected static final ConcurrentHashMap<String, DebugManagedDataSource> dsCache = new ConcurrentHashMap<String, DebugManagedDataSource>(); + protected static final ConcurrentHashMap<String, DebugManagedDataSource<? extends Connection>> dsCache = + new ConcurrentHashMap<>(); public Connection getConnection(GenericHelperInfo helperInfo, JdbcElement abstractJdbc) throws SQLException, GenericEntityException { String cacheKey = helperInfo.getHelperFullName(); - DebugManagedDataSource mds = dsCache.get(cacheKey); + DebugManagedDataSource<? extends Connection> mds = dsCache.get(cacheKey); if (mds != null) { return TransactionUtil.getCursorConnection(helperInfo, mds.getConnection()); } @@ -127,7 +128,7 @@ public class DBCPConnectionFactory imple } // configure the pool settings - GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig(); + GenericObjectPoolConfig<PoolableConnection> poolConfig = new GenericObjectPoolConfig<>(); poolConfig.setMaxTotal(maxSize); // settings for idle connections poolConfig.setMaxIdle(maxIdle); @@ -148,7 +149,7 @@ public class DBCPConnectionFactory imple GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<PoolableConnection>(factory, poolConfig); factory.setPool(pool); - mds = new DebugManagedDataSource(pool, xacf.getTransactionRegistry()); + mds = new DebugManagedDataSource<>(pool, xacf.getTransactionRegistry()); mds.setAccessToUnderlyingConnectionAllowed(true); // cache the pool @@ -165,7 +166,7 @@ public class DBCPConnectionFactory imple public static Map<String, Object> getDataSourceInfo(String helperName) { Map<String, Object> dataSourceInfo = new HashMap<String, Object>(); - DebugManagedDataSource mds = dsCache.get(helperName); + DebugManagedDataSource<? extends Connection> mds = dsCache.get(helperName); if (mds != null) { dataSourceInfo = mds.getInfo(); } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java Tue Dec 11 13:33:49 2018 @@ -30,11 +30,11 @@ import org.apache.commons.pool2.ObjectPo import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.ofbiz.base.util.Debug; -public class DebugManagedDataSource extends ManagedDataSource { +public class DebugManagedDataSource<C extends Connection> extends ManagedDataSource<C> { public static final String module = DebugManagedDataSource.class.getName(); - public DebugManagedDataSource(ObjectPool pool, TransactionRegistry transactionRegistry) { + public DebugManagedDataSource(ObjectPool<C> pool, TransactionRegistry transactionRegistry) { super(pool, transactionRegistry); } @@ -42,7 +42,7 @@ public class DebugManagedDataSource exte public Connection getConnection() throws SQLException { if (Debug.verboseOn()) { if (super.getPool() instanceof GenericObjectPool) { - GenericObjectPool objectPool = (GenericObjectPool)super.getPool(); + GenericObjectPool<?> objectPool = (GenericObjectPool<?>)super.getPool(); Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + objectPool.getNumActive() + "/" + objectPool.getNumIdle() + "/" + (objectPool.getNumActive() + objectPool.getNumIdle()) + "; min idle/max idle/max total: " + objectPool.getMinIdle() + "/" + objectPool.getMaxIdle() + "/" + objectPool.getMaxTotal(), module); } else { if (Debug.verboseOn()) Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + super.getPool().getNumActive() + "/" + super.getPool().getNumIdle() + "/" + (super.getPool().getNumActive() + super.getPool().getNumIdle()), module); @@ -57,7 +57,7 @@ public class DebugManagedDataSource exte dataSourceInfo.put("poolNumIdle", super.getPool().getNumIdle()); dataSourceInfo.put("poolNumTotal", (super.getPool().getNumIdle() + super.getPool().getNumActive())); if (super.getPool() instanceof GenericObjectPool) { - GenericObjectPool objectPool = (GenericObjectPool)super.getPool(); + GenericObjectPool<?> objectPool = (GenericObjectPool<?>)super.getPool(); dataSourceInfo.put("poolMaxActive", objectPool.getMaxTotal()); dataSourceInfo.put("poolMaxIdle", objectPool.getMaxIdle()); dataSourceInfo.put("poolMaxWait", objectPool.getMaxWaitMillis()); @@ -67,4 +67,18 @@ public class DebugManagedDataSource exte return dataSourceInfo; } + // Ensures that the close() method does not throw an InterruptedException + // to conform to the AutoCloseable interface. + // This is fixing what should be down in org.apache.commons.dbcp2.PoolingDataSource. + @Override + public void close() throws SQLException, RuntimeException { + try { + super.close(); + } catch (SQLException | RuntimeException e) { + throw e; + } catch (Exception e) { + Debug.log(e); + } + } + } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java Tue Dec 11 13:33:49 2018 @@ -798,7 +798,7 @@ public class DatabaseUtil { protected Detection(String name, boolean required, String methodName, Object... params) throws NoSuchMethodException { this.name = name; this.required = required; - Class[] paramTypes = new Class[params.length]; + Class<?>[] paramTypes = new Class<?>[params.length]; for (int i = 0; i < params.length; i++) { Class<?> paramType = params[i].getClass(); if (paramType == Integer.class) { Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java?rev=1848673&r1=1848672&r2=1848673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java Tue Dec 11 13:33:49 2018 @@ -58,6 +58,7 @@ import org.w3c.dom.Element; * An object that models the <code><entity></code> element. * */ +@SuppressWarnings("serial") public class ModelEntity implements Comparable<ModelEntity>, Serializable { public static final String module = ModelEntity.class.getName(); |
Free forum by Nabble | Edit this page |