Login  Register

Where to set breakpoint for this error?

Posted by Chuck22 on Jun 30, 2006; 3:44am
URL: http://ofbiz.116.s1.nabble.com/Where-to-set-breakpoint-for-this-error-tp169166.html

Hi

The error message I got.
*******************************************
 org.ofbiz.base.util.GeneralException: Error rendering screen
[component://ecommerce/widget/CatalogScreens.xml#product]:
org.ofbiz.base.util.GeneralException: Error rendering screen
[component://ecommerce/widget/CommonScreens.xml#main-decorator]:
org.ofbiz.base.util.GeneralException: Error rendering screen
[component://ecommerce/widget/CatalogScreens.xml#productdetail]:
org.ofbiz.base.util.GeneralException: Error running BSH script at location
[component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh]:
org.ofbiz.base.util.GeneralException: Error running BSH script at
[component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh],
line [384]: Sourced file:
*component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
: Method Invocation dispatcher.runSync : at Line: 384 : *in file:
component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
: dispatcher .runSync ( "*getAssociatedProducts*" , UtilMisc .toMap (
"productId" , productId , "type" , "PRODUCT_OBSOLESCENCE" , "checkViewAllow"
, Boolean .TRUE , "prodCatalogId" , currentCatalogId ) )
....
********************************

It seems to me the error came from getAssociatedProducts method in
ProductWorker class. But when I set a breakpoint there, it is not called.


// get product associations (this is line 384)
    obsoleteProducts = dispatcher.runSync("getAssociatedProducts",
UtilMisc.toMap("productId", productId, "type", "PRODUCT_OBSOLESCENCE",
"checkViewAllow", Boolean.TRUE, "prodCatalogId", currentCatalogId));


The getAssociatedProducts method is not called in my debugging. I set
several breakpints in this method and they all failed to halt execution. My
debugging works fine in other code place.


public static void getAssociatedProducts(PageContext pageContext, String
productAttributeName, String assocPrefix) {
        GenericDelegator delegator = (GenericDelegator)
pageContext.getRequest().getAttribute("delegator");
        GenericValue product = (GenericValue) pageContext.getAttribute
(productAttributeName);

        if (product == null)
            return;

        try {
            List upgradeProducts = product.getRelatedByAndCache
("MainProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_UPGRADE"));

            List complementProducts = product.getRelatedByAndCache
("MainProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_COMPLEMENT"));

            List obsolescenceProducts = product.getRelatedByAndCache
("AssocProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_OBSOLESCENCE"));

            List obsoleteByProducts = product.getRelatedByAndCache
("MainProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_OBSOLESCENCE"));

            // since ProductAssoc records have a fromDate and thruDate, we
can filter by now so that only assocs in the date range are included
            upgradeProducts = EntityUtil.filterByDate(upgradeProducts,
true);
            complementProducts = EntityUtil.filterByDate(complementProducts,
true);
            obsolescenceProducts =
EntityUtil.filterByDate(obsolescenceProducts,
true);
            obsoleteByProducts =
EntityUtil.filterByDate(obsoleteByProducts, true);

            if (upgradeProducts != null && upgradeProducts.size() > 0)
                pageContext.setAttribute(assocPrefix + "upgrade",
upgradeProducts);
            if (complementProducts != null && complementProducts.size() > 0)
                pageContext.setAttribute(assocPrefix + "complement",
complementProducts);
            if (obsolescenceProducts != null && obsolescenceProducts.size ()
> 0)
                pageContext.setAttribute(assocPrefix + "obsolescence",
obsolescenceProducts);
            if (obsoleteByProducts != null && obsoleteByProducts.size() > 0)
                pageContext.setAttribute(assocPrefix + "obsoleteby",
obsoleteByProducts);
        } catch (GenericEntityException e) {
            Debug.logWarning(e, module);
        }
    }

I don't know where to go to find the cause of my error. Please advise.
Thanks.