Product NOTFOUND causes java.lang.NullPointerException, ugly screen, and 
excessive logging
------------------------------------------------------------------------------------------

                 Key: OFBIZ-4599
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4599
             Project: OFBiz
          Issue Type: Bug
          Components: specialpurpose/ecommerce
    Affects Versions: Release Branch 11.04, SVN trunk
         Environment: Any
            Reporter: mz4wheeler
            Priority: Minor


If you manually enter a URL (or via search engine) for a non-existing product, 
the following (annoying) long java exception is logged.

2011-11-30 20:56:35,431 (TP-Processor3) [        ModelScreen.java:401:ERROR] 
Error rendering screen 
[component://ecommerce/widget/CatalogScreens.xml#product]: 
java.lang.NullPointerException: Cannot get property 'isVirtual' on null object. 
Rolling back transaction.
2011-11-30 20:56:35,436 (TP-Processor3) [    TransactionUtil.java:349:INFO ] 
[TransactionUtil.rollback] transaction rolled back
2011-11-30 20:56:35,437 (TP-Processor3) [    TransactionUtil.java:274:WARN ] 
[TransactionUtil.commit] Not committing transaction, status is No Transaction 
(6)
2011-11-30 20:56:35,446 (TP-Processor3) [     ControlServlet.java:227:ERROR]
---- exception report ----------------------------------------------------------
Error in request handler:
Exception: org.ofbiz.widget.screen.ScreenRenderException
Message: Error rendering screen 
[component://ecommerce/widget/CatalogScreens.xml#product]: 
java.lang.NullPointerException: Cannot get property 'isVirtual' on null object 
(Cannot get property 'isVirtual' on null object)
---- cause ---------------------------------------------------------------------
Exception: java.lang.NullPointerException
Message: Cannot get property 'isVirtual' on null object
---- stack trace ---------------------------------------------------------------
java.lang.NullPointerException: Cannot get property 'isVirtual' on null object
org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56)
org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156)
org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:235)
Product.run(Product.groovy:48)
.... etc ... etc ... etc ...
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
java.lang.Thread.run(Thread.java:662)
--------------------------------------------------------------------------------
2011-11-30 20:56:35,449 (TP-Processor3) [     ControlServlet.java:243:ERROR] An 
error occurred, going to the errorPage: /error/error.jsp
2011-11-30 20:56:35,450 (TP-Processor3) [     ControlServlet.java:250:ERROR] 
Including errorPage: /error/error.jsp
2011-11-30 20:56:37,437 (TP-Processor3) [     ControlServlet.java:324:INFO ] 
[[[product] Request Done- total:6.14,since last([product] Request...):6.14]]

On top of this, the following (BIG RED) error screen is shown to the user:

:ERROR MESSAGE:
org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen 
[component://ecommerce/widget/CatalogScreens.xml#product]: 
java.lang.NullPointerException: Cannot get property 'isVirtual' on null object 
(Cannot get property 'isVirtual' on null object)

This is caused by Product.groovy performing a search for a product (which 
fails) and then trying to reference "product.isVariant", which doesn't exist.

After the simple patch, the store now shows the default ecommerce screen, with 
the following message in the main ecommerce area:

RESULT: "Product not found for Product ID 1001JAPANCROS!"

Much better.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to