Author: deepak
Date: Sat Mar 21 14:33:15 2015
New Revision: 1668277
URL:
http://svn.apache.org/r1668277Log:
OFBIZ-6070: Fixed error while creating the ProductContent. Added check to avoid foreign key constraints.
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=1668277&r1=1668276&r2=1668277&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java Sat Mar 21 14:33:15 2015
@@ -1099,9 +1099,18 @@ public class ProductServices {
for ( String sizeType : ScaleImage.sizeTypeList ) {
imageUrl = imageUrlMap.get(sizeType);
if( UtilValidate.isNotEmpty(imageUrl)) {
- result = addImageResource(dispatcher, delegator, context, imageUrl, "XTRA_IMG_" + viewNumber + "_" + sizeType.toUpperCase());
- if( ServiceUtil.isError(result)) {
- return result;
+ try {
+ GenericValue productContentType = EntityQuery.use(delegator).from("ProductContentType").where("productContentTypeId", "XTRA_IMG_" + viewNumber + "_" + sizeType.toUpperCase()).cache().queryOne();
+ if (UtilValidate.isNotEmpty(productContentType)) {
+ result = addImageResource(dispatcher, delegator, context, imageUrl, "XTRA_IMG_" + viewNumber + "_" + sizeType.toUpperCase());
+ if( ServiceUtil.isError(result)) {
+ Debug.logError(ServiceUtil.getErrorMessage(result), module);
+ return result;
+ }
+ }
+ } catch(GenericEntityException e) {
+ Debug.logError(e,module);
+ return ServiceUtil.returnError(e.getMessage());
}
}
}