You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2011/03/13 11:05:36 UTC

svn commit: r1081068 - in /ofbiz/trunk/applications/product/src/org/ofbiz/product: image/ScaleImage.java imagemanagement/FrameImage.java imagemanagement/ImageManagementServices.java imagemanagement/ReplaceImage.java

Author: mrisaliti
Date: Sun Mar 13 10:05:36 2011
New Revision: 1081068

URL: http://svn.apache.org/viewvc?rev=1081068&view=rev
Log:
Remove some reduntant cast warning in product component (OFBIZ-4102)

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java?rev=1081068&r1=1081067&r2=1081068&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java Sun Mar 13 10:05:36 2011
@@ -248,7 +248,7 @@ public class ScaleImage {
     
         /* ImageProperties.xml */
         String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml";
-        resultXMLMap.putAll((Map<String, Object>) ImageTransform.getXMLValue(imgPropertyFullPath, locale));
+        resultXMLMap.putAll(ImageTransform.getXMLValue(imgPropertyFullPath, locale));
         if (resultXMLMap.containsKey("responseMessage") && resultXMLMap.get("responseMessage").equals("success")) {
             imgPropertyMap.putAll(UtilGenerics.<Map<String, Map<String, String>>>cast(resultXMLMap.get("xml")));
         } else {

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java?rev=1081068&r1=1081067&r2=1081068&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java Sun Mar 13 10:05:36 2011
@@ -150,8 +150,8 @@ public class FrameImage {
             String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
             String filenameTouseThumb = (String) contentResult.get("contentId") + nameOfThumb + ".jpg";
             
-            Image newImg1 = bufImg1.getScaledInstance((int) width, (int) height , Image.SCALE_SMOOTH);
-            Image newImg2 = bufImg2.getScaledInstance((int) width , (int) height , Image.SCALE_SMOOTH);
+            Image newImg1 = bufImg1.getScaledInstance(width, height , Image.SCALE_SMOOTH);
+            Image newImg2 = bufImg2.getScaledInstance(width , height , Image.SCALE_SMOOTH);
             BufferedImage bufNewImg = combineBufferedImage(newImg1, newImg2, bufImgType);
             String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
             ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/" + productId + "/" + filenameToUse));
@@ -344,8 +344,8 @@ public class FrameImage {
             request.setAttribute("_ERROR_MESSAGE_", "Required frame image content ID or dataResource ID parameters. Please upload new frame image or choose the exist frame.");
             return "error";
         }
-        String frameContentId = (String) request.getParameter("frameContentId");
-        String frameDataResourceId = (String) request.getParameter("frameDataResourceId");
+        String frameContentId = request.getParameter("frameContentId");
+        String frameDataResourceId = request.getParameter("frameDataResourceId");
         
         if (UtilValidate.isEmpty(request.getParameter("imageWidth")) || UtilValidate.isEmpty(request.getParameter("imageHeight"))) {
             String errMsg = "Image Width and Image Height are required to preview the image. Please enter in Image Width and Image Height fields.";
@@ -380,8 +380,8 @@ public class FrameImage {
             int width = Integer.parseInt(request.getParameter("imageWidth"));
             int height= Integer.parseInt(request.getParameter("imageHeight"));
             
-            Image newImg1 = bufImg1.getScaledInstance((int) width, (int) height , Image.SCALE_SMOOTH);
-            Image newImg2 = bufImg2.getScaledInstance((int) width , (int) height , Image.SCALE_SMOOTH);
+            Image newImg1 = bufImg1.getScaledInstance(width, height , Image.SCALE_SMOOTH);
+            Image newImg2 = bufImg2.getScaledInstance(width , height , Image.SCALE_SMOOTH);
             BufferedImage bufNewImg = combineBufferedImage(newImg1, newImg2, bufImgType);
             String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
             ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/preview/" + "/previewImage.jpg"));
@@ -406,7 +406,7 @@ public class FrameImage {
             return "error";
         }
         
-        String frameContentId = (String) request.getParameter("frameContentId");
+        String frameContentId = request.getParameter("frameContentId");
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         
         String frameDataResourceId = null;

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1081068&r1=1081067&r2=1081068&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Sun Mar 13 10:05:36 2011
@@ -347,7 +347,7 @@ public class ImageManagementServices {
         
         /* ImageProperties.xml */
         String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml";
-        resultXMLMap.putAll((Map<String, Object>) ImageTransform.getXMLValue(imgPropertyFullPath, locale));
+        resultXMLMap.putAll(ImageTransform.getXMLValue(imgPropertyFullPath, locale));
         if (resultXMLMap.containsKey("responseMessage") && resultXMLMap.get("responseMessage").equals("success")) {
             imgPropertyMap.putAll(UtilGenerics.<Map<String, Map<String, String>>>cast(resultXMLMap.get("xml")));
         } else {
@@ -682,7 +682,7 @@ public class ImageManagementServices {
         FileItem imageFi = null;
         byte[] imageBytes = {};
         for (int i=0; i < lst.size(); i++) {
-            fi = (FileItem)lst.get(i);
+            fi = lst.get(i);
             String fieldName = fi.getFieldName();
             if (fi.isFormField()) {
                 String fieldStr = fi.getString();
@@ -1047,7 +1047,7 @@ public class ImageManagementServices {
                 List<GenericValue> contentAssocList = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL"));
                 if (contentAssocList.size() > 0) {
                     for (int i = 0; i < contentAssocList.size(); i++) {
-                        GenericValue contentAssoc = (GenericValue) contentAssocList.get(i);
+                        GenericValue contentAssoc = contentAssocList.get(i);
                         
                         List<GenericValue> dataResourceAssocList = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("contentId", contentAssoc.get("contentIdTo")));
                         GenericValue dataResourceAssoc = EntityUtil.getFirst(dataResourceAssocList);

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java?rev=1081068&r1=1081067&r2=1081068&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java Sun Mar 13 10:05:36 2011
@@ -83,7 +83,7 @@ public class ReplaceImage{
             List<GenericValue> contentAssocReplaceList = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdReplace, "contentAssocTypeId", "IMAGE_THUMBNAIL"));
             if (contentAssocReplaceList.size() > 0) {
                 for (int i = 0; i < contentAssocReplaceList.size(); i++) {
-                    GenericValue contentAssocReplace = (GenericValue) contentAssocReplaceList.get(i);
+                    GenericValue contentAssocReplace = contentAssocReplaceList.get(i);
                     
                     List<GenericValue> dataResourceAssocReplaceList = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("contentId", contentAssocReplace.get("contentIdTo")));
                     GenericValue dataResourceAssocReplace = EntityUtil.getFirst(dataResourceAssocReplaceList);