Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-6057

Quote item view FreeMarker error due Freemarker 2.3 versions higher than 2.3.19



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: Release Branch 12.04, Release Branch 13.07, Release Branch 14.12, Trunk
    • Fix Version/s: 14.12.01, 13.07.02, 16.11.01
    • Component/s: accounting, order
    • Labels:
    • Environment:



      In order to fix OFBIZ-2120, code was added to the applications/order/webapp/ordermgr/quote/ViewQuoteItemInfo.ftl file at lines 53 through 57, with the offending line being at 5:


      Here is the commit: https://github.com/apache/ofbiz/commit/27253c4667e87721212fa8955d75c74a0d171c73

      This ends up causing the following error:

      [java] freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
      [java] ==> null [in template "component://order/webapp/ordermgr/quote/ViewQuoteItemInfo.ftl" at line 56, column 40]
      [java] ----
      [java] Tip: If the failing expression is known to be legally refer to something that's null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
      [java] ----
      [java] ----
      [java] FTL stack trace ("~" means nesting-related):
      [java] - Failed at: #assign product = null [in template "component://order/webapp/ordermgr/quote/ViewQuoteItemInfo.ftl" at line 56, column 21]
      [java] - Reached through: #list quoteItems as quoteItem [in template "component://order/webapp/ordermgr/quote/ViewQuoteItemInfo.ftl" at line 52, column 13]

      The main reason for this is because there is no concept of "null" in FreeMarker 2.3, as the following thread explains: http://ehc.ac/p/freemarker/discussion/2346/thread/85da30a4/ Not sure how to go about fixing this error, the thread suggests setting the variable to the string "null".

      There are other instances of this bug as well:

      $ grep -r "<#assign" * | grep "= null"
      applications/order/webapp/ordermgr/return/returnItems.ftl: <#assign returnItemSubTotal = null > <#-- otherwise the last item's might carry over -->
      applications/order/webapp/ordermgr/quote/ViewQuoteItemInfo.ftl: <#assign product = null> <#-- don't drag it along to the next iteration -->
      applications/accounting/webapp/accounting/reports/DepositSlip.fo.ftl: <#assign creditCard = null/>
      framework/webtools/webapp/webtools/datafile/viewdatafile.ftl: <#assign lastRecordName = null>

      Reproduction Steps:

      1) Visit http://demo-stable-ofbiz.apache.org/ordermgr/control/FindRequest
      2) Click "New Request"
      3) Set

      • Cust Request Type Id = Request for Quote
      • Requesting Party = DemoCustomer
      • Cust Request Name = Test Request
      • Description = This is a test request

      4) Click "Sumbit"
      5) "Create Quote from request"
      6) error will appear


          Issue Links



              • Assignee:
                deepak Deepak Dixit
                fbr@14x.net Forrest Rae
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: