diff --git a/.classpath b/.classpath
index aaff8e0d19..eb8eacdd97 100644
--- a/.classpath
+++ b/.classpath
@@ -144,7 +144,7 @@
-
+
diff --git a/LICENSE b/LICENSE
index 3e81d9a1f8..361265af6a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -366,7 +366,7 @@ Illinois, Urbana-Champaign.
=========================================================================
The following libraries distributed with Apache OFBiz are licensed under the
JDOM (Modified Apache) License:
-ofbiz/trunk/framework/webapp/lib/jdom-1.0.jar
+ofbiz/trunk/framework/webapp/lib/jdom-1.1.jar
=========================================================================
The JDOM License
Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
diff --git a/applications/product/src/org/ofbiz/image/ImageTransform.java b/applications/product/src/org/ofbiz/image/ImageTransform.java
index d9380eb051..eccf15fe2f 100644
--- a/applications/product/src/org/ofbiz/image/ImageTransform.java
+++ b/applications/product/src/org/ofbiz/image/ImageTransform.java
@@ -18,54 +18,43 @@
*******************************************************************************/
package org.ofbiz.image;
+import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.ImagingOpException;
-import java.awt.RenderingHints;
-import java.awt.RenderingHints.Key;
import java.io.File;
import java.io.IOException;
-import java.lang.IllegalArgumentException;
-import java.lang.Double;
-import java.lang.Object;
-import java.lang.String;
-import java.lang.System;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
-import javolution.util.FastList;
import javolution.util.FastMap;
import org.jdom.Document;
import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.jdom.filter.Filter;
import org.jdom.JDOMException;
-
+import org.jdom.input.SAXBuilder;
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.string.FlexibleStringExpander;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
import org.ofbiz.service.ServiceUtil;
/**
* ImageTransform Class
*
- * Services to apply tranformation for images
+ * Services to apply transformation to images
*/
public class ImageTransform {
public static final String module = ImageTransform.class.getName();
-// public static final String err_resource = "ContentErrorUiLabels";
+ public static final String err_resource = "ProductErrorUiLabels";
- public ImageTransform() {}
-
+ public ImageTransform() {}
/**
* getBufferedImage
@@ -73,17 +62,17 @@ public class ImageTransform {
* Set a buffered image
*
* @param context
- * @param fileLocation Full file Path or Url
- * @return Url images for all different size types
+ * @param fileLocation Full file Path or URL
+ * @return URL images for all different size types
* @throws IOException Error prevents the document from being fully parsed
* @throws JDOMException Errors occur in parsing
*/
- public Map getBufferedImage(String fileLocation)
+ public Map getBufferedImage(String fileLocation)
throws IllegalArgumentException, IOException {
/* VARIABLES */
BufferedImage bufImg;
- FastMap result = new FastMap();
+ Map result = FastMap.newInstance();
/* BUFFERED IMAGE */
try{
@@ -104,7 +93,7 @@ public class ImageTransform {
result.put("bufferedImage", bufImg);
return result;
- } // getBufferedImage
+ }
/**
@@ -116,34 +105,34 @@ public class ImageTransform {
* @param filenameToUse Filename of future image files
* @param viewType "Main" view or "additional" view
* @param viewNumber If it's the main view, viewNumber = "0"
- * @return Url images for all different size types
+ * @return URL images for all different size types
* @throws IllegalArgumentException Any parameter is null
* @throws ImagingOpException The transform is non-invertible
* @throws IOException Error prevents the document from being fully parsed
* @throws JDOMException Errors occur in parsing
*/
- public Map scaleImageInAllSize(Map context, String filenameToUse, String viewType, String viewNumber)
+ public Map scaleImageInAllSize(Map context, String filenameToUse, String viewType, String viewNumber)
throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {
/* VARIABLES */
List sizeTypeList = UtilMisc.toList("small", "medium", "large", "detail");
List extensionList = UtilMisc.toList("jpeg", "jpg", "png");
int index;
- LinkedHashMap> imgPropertyMap = new LinkedHashMap>();
+ Map> imgPropertyMap = FastMap.newInstance();
BufferedImage bufImg, bufNewImg;
- double imgHeight, imgWidth, defaultHeight, defaultWidth, scaleFactor;
+ double imgHeight, imgWidth, scaleFactor;
AffineTransformOp op;
- LinkedHashMap imgUrlMap = new LinkedHashMap();
- LinkedHashMap resultXMLMap = new LinkedHashMap();
- LinkedHashMap resultBufImgMap = new LinkedHashMap();
- LinkedHashMap resultScaleImgMap = new LinkedHashMap();
- FastMap result = new FastMap();
+ Map imgUrlMap = FastMap.newInstance();
+ Map resultXMLMap = FastMap.newInstance();
+ Map resultBufImgMap = FastMap.newInstance();
+ Map resultScaleImgMap = FastMap.newInstance();
+ Map result = FastMap.newInstance();
/* ImageProperties.xml */
String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml";
- resultXMLMap.putAll(getXMLValue(imgPropertyFullPath));
+ resultXMLMap.putAll((Map) getXMLValue(imgPropertyFullPath));
if(resultXMLMap.containsKey("responseMessage") && resultXMLMap.get("responseMessage").equals("success")){
- imgPropertyMap.putAll((LinkedHashMap) resultXMLMap.get("xml"));
+ imgPropertyMap.putAll((Map>) resultXMLMap.get("xml"));
}else{
String errMsg = "Impossible to parse ImageProperties.xml ";
Debug.logError(errMsg, module);
@@ -161,8 +150,8 @@ public class ImageTransform {
String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
String imageUrlPrefix = UtilProperties.getPropertyValue("catalog", "image.url.prefix");
- String id = new String();
- String type = new String();
+ String id = null;
+ String type = null;
if(viewType.toLowerCase().contains("main")){
type = "original";
id = imgName;
@@ -217,7 +206,7 @@ public class ImageTransform {
scaleFactor = scaleFactorDb.doubleValue();
// define Interpolation
- LinkedHashMap rhMap = new LinkedHashMap();
+ Map rhMap = FastMap.newInstance();
rhMap.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
rhMap.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
rhMap.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
@@ -244,7 +233,7 @@ public class ImageTransform {
}
// write the New Scaled Image
- String newFileLocation = new String();
+ String newFileLocation = null;
if(viewType.toLowerCase().contains("main")){
newFileLocation = mainFilenameExpander.expandString(UtilMisc.toMap("location", "products", "type", sizeType, "id", id));
}else if(viewType.toLowerCase().contains("additional")){
@@ -256,7 +245,7 @@ public class ImageTransform {
}
// choose final extension
- String finalExtension = new String();
+ String finalExtension = null;
if(!extensionList.contains(imgExtension.toLowerCase())){
finalExtension = imgPropertyMap.get("format").get("extension");
}else{
@@ -307,7 +296,7 @@ public class ImageTransform {
return ServiceUtil.returnError(errMsg);
}
- } // scaleImageInAllSize
+ }
/**
@@ -322,12 +311,12 @@ public class ImageTransform {
* @param sizeType Size type to scale
* @return New scaled buffered image
*/
- private Map scaleImage(BufferedImage bufImg, double imgHeight, double imgWidth, LinkedHashMap> dimensionMap, String sizeType){
+ private Map scaleImage(BufferedImage bufImg, double imgHeight, double imgWidth, Map> dimensionMap, String sizeType){
/* VARIABLES */
BufferedImage bufNewImg;
double defaultHeight, defaultWidth, scaleFactor;
- FastMap result = new FastMap();
+ Map result = FastMap.newInstance();
/* DIMENSIONS from ImageProperties */
defaultHeight = Double.parseDouble(dimensionMap.get(sizeType).get("height").toString());
@@ -381,7 +370,7 @@ public class ImageTransform {
result.put("scaleFactor", scaleFactor);
return result;
- } // scaleImage
+ }
/**
@@ -392,15 +381,14 @@ public class ImageTransform {
* @param fileFullPath File path to parse
* @return Map contains asked attribute values by attribute name
*/
- private Map getXMLValue(String fileFullPath)
+ private Map getXMLValue(String fileFullPath)
throws IllegalStateException, IOException, JDOMException {
/* VARIABLES */
Document document;
Element rootElt;
- List eltList;
- LinkedHashMap valueMap = new LinkedHashMap();
- FastMap result = new FastMap();
+ Map> valueMap = FastMap.newInstance();
+ Map result = FastMap.newInstance();
/* PARSING */
SAXBuilder sxb = new SAXBuilder();
@@ -429,16 +417,14 @@ public class ImageTransform {
}
/* get NAME and VALUE */
- Iterator eltIter = rootElt.getChildren().iterator();
- while(eltIter.hasNext()){
- Element currentElt = eltIter.next();
- LinkedHashMap eltMap = new LinkedHashMap();
+ List children = rootElt.getChildren(); // FIXME : despite upgrading to jdom 1.1, it seems that getChildren is pre 1.5 java code (ie getChildren does not retun List but only List)
+ for (Element currentElt : children) {
+ Map eltMap = FastMap.newInstance();
if(currentElt.getContentSize() > 0){
- LinkedHashMap childMap = new LinkedHashMap();
+ Map childMap = FastMap.newInstance();
// loop over Children 1st level
- Iterator childrenIter = currentElt.getChildren().iterator();
- while(childrenIter.hasNext()){
- Element currentChild = childrenIter.next();
+ List children2 = currentElt.getChildren();
+ for (Element currentChild : children2) {
childMap.put(currentChild.getAttributeValue("name"), currentChild.getAttributeValue("value"));
}
valueMap.put(currentElt.getAttributeValue("name"), childMap);
@@ -446,12 +432,11 @@ public class ImageTransform {
eltMap.put(currentElt.getAttributeValue("name"), currentElt.getAttributeValue("value"));
valueMap.put(currentElt.getName(), eltMap);
}
- } // eltIter
+ }
result.put("responseMessage", "success");
result.put("xml", valueMap);
return result;
- } // getXMLValue
-
-} // ImageTransform Class
+ }
+}
diff --git a/applications/product/src/org/ofbiz/product/product/ProductServices.java b/applications/product/src/org/ofbiz/product/product/ProductServices.java
index 42a8f69a19..5bde2ab924 100644
--- a/applications/product/src/org/ofbiz/product/product/ProductServices.java
+++ b/applications/product/src/org/ofbiz/product/product/ProductServices.java
@@ -960,10 +960,9 @@ public class ProductServices {
}
/* scale Image in different sizes */
- String viewNumber = new String();
- viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
+ String viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
ImageTransform imageTransform = new ImageTransform();
- FastMap resultResize = new FastMap();
+ Map resultResize = FastMap.newInstance();
try{
resultResize.putAll(imageTransform.scaleImageInAllSize(context, filenameToUse, "additional", viewNumber));
}catch(IOException e){
diff --git a/framework/webapp/lib/jdom-1.0.jar b/framework/webapp/lib/jdom-1.0.jar
deleted file mode 100644
index 288e64cb5c..0000000000
Binary files a/framework/webapp/lib/jdom-1.0.jar and /dev/null differ
diff --git a/framework/webapp/lib/jdom-1.1.jar b/framework/webapp/lib/jdom-1.1.jar
new file mode 100644
index 0000000000..b0b22e68ad
Binary files /dev/null and b/framework/webapp/lib/jdom-1.1.jar differ