Author: ashish
Date: Sat Jul 22 11:15:03 2017 New Revision: 1802673 URL: http://svn.apache.org/viewvc?rev=1802673&view=rev Log: Improved: Use FlexibleLocation.resolveLocation() instead of hard-coded path.(OFBIZ-9479) Thanks Devanshu for the contribution. Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java?rev=1802673&r1=1802672&r2=1802673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java Sat Jul 22 11:15:03 2017 @@ -29,6 +29,7 @@ import java.util.Map; import javax.imageio.ImageIO; +import org.apache.ofbiz.base.location.FlexibleLocation; import org.jdom.JDOMException; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilGenerics; @@ -90,7 +91,8 @@ public class ScaleImage { Map<String, Object> result = new HashMap<String, Object>(); /* ImageProperties.xml */ - String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml"; + String fileName = "component://product/config/ImageProperties.xml"; + String imgPropertyFullPath = FlexibleLocation.resolveLocation(fileName).getFile(); 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"))); @@ -270,7 +272,8 @@ public class ScaleImage { Map<String, Object> result = new HashMap<String, Object>(); /* ImageProperties.xml */ - String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml"; + String fileName = "component://product/config/ImageProperties.xml"; + String imgPropertyFullPath = FlexibleLocation.resolveLocation(fileName).getFile(); 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"))); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1802673&r1=1802672&r2=1802673&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java Sat Jul 22 11:15:03 2017 @@ -35,6 +35,7 @@ import java.util.Map; import javax.imageio.ImageIO; +import org.apache.ofbiz.base.location.FlexibleLocation; import org.jdom.JDOMException; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilDateTime; @@ -321,7 +322,8 @@ public class ImageManagementServices { Map<String, Object> result = new HashMap<String, Object>(); /* ImageProperties.xml */ - String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml"; + String fileName = "component://product/config/ImageProperties.xml"; + String imgPropertyFullPath = FlexibleLocation.resolveLocation(fileName).getFile(); 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"))); |
Free forum by Nabble | Edit this page |