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

TrackingCodeEvents#checkTrackingCodeUrlParam returns "error" if tracking code is not available

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: 17.12.01
    • Component/s: marketing
    • Labels:
      None

      Description

      In TrackingCodeEvents#checkTrackingCodeUrlParam, a provided tracking code is checked against the database. If not found, it returns "error".

                  if (trackingCode == null) {
                      Debug.logError("TrackingCode not found for trackingCodeId [" + trackingCodeId + "], ignoring this trackingCodeId.", module);
                      //this return value will be ignored, but we'll designate this as an error anyway
                      return "error";
                  }
      

      The notice "return value is ignored" is not true because in the event handler, a non-success return value is handled to throw an excpetion:

                  // Invoke the pre-processor (but NOT in a chain)
                  for (ConfigXMLReader.Event event: controllerConfig.getPreprocessorEventList().values()) {
                      try {
                          String returnString = this.runEvent(request, response, event, null, "preprocessor");
                          if (returnString != null && !returnString.equalsIgnoreCase("success")) {
                              if (!returnString.contains(":_protect_:")) {
                                  throw new EventHandlerException("Pre-Processor event [" + event.invoke + "] did not return 'success'.");
                              } else { // protect the view normally rendered and redirect to error response view
                                  returnString = returnString.replace(":_protect_:", "");
                                  if (returnString.length() > 0) {
                                      request.setAttribute("_ERROR_MESSAGE_", returnString);
                                  }
                                  eventReturn = null;
                                  // check to see if there is a "protect" response, if so it's ok else show the default_error_response_view
                                  if (!requestMap.requestResponseMap.containsKey("protect")) {
                                      String protectView = controllerConfig.getProtectView();
                                      if (protectView != null) {
                                          overrideViewUri = protectView;
                                      } else {
                                          overrideViewUri = UtilProperties.getPropertyValue("security.properties", "default.error.response.view");
                                          overrideViewUri = overrideViewUri.replace("view:", "");
                                          if ("none:".equals(overrideViewUri)) {
                                              interruptRequest = true;
                                          }
                                      }
                                  }
                              }
                          } else if (returnString == null) {
                              interruptRequest = true;
                          }
                      } catch (EventHandlerException e) {
                          Debug.logError(e, module);
                      }
                  }
      

      This leads to a flood of Exception stacktraces in the OFBiz logs.

      In my opinion, the checkTrackingCodeUrlParam method should return "success" if the tracking code is not found and should log to loglevel "info". It's not an error.

      What do others think?

        Attachments

          Activity

            People

            • Assignee:
              mbrohl Michael Brohl
              Reporter:
              mbrohl Michael Brohl
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: