Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3694

JSONResult - buildSMDObject method is never called internally

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.3.1
    • 2.3.1
    • Plugin - JSON
    • None
    • Tomcat on windows, JDK1.5

    Description

      Pre version 2.2.3.1 JSONResult object used to have a protected method that allowed us to have a subclass that could modify URL of the SMD command being sent in the response right before it was sent. That method was "writeSMD". In version 2.2.3.1 of Struts there is no more method named "writeSMD", but there appears to be equivalent protected method named "buildSMDObject". However, we observed that buildSMDObject is never called by the infrastructure, so there is no use overriding it.

      After inspecting source for JSONResult, it looks like line 180 in the readRootObject function is really intended to call buildSMDObject. However, instead of calling the protected method in question, it creates SMD object right there.

      if (enableSMD)

      { return new SMDGenerator(root, excludeProperties, ignoreInterfaces).generate(invocation); }

      Fixing line 180 to call buildSMDObject should fix the issue. We had to significantly re-write our subclass for JSONResult to work around the deficiency. Hope this can be fixed in a future release.

      Attachments

        1. WW-3694.patch
          1 kB
          Maurizio Cucchiara

        Issue Links

          Activity

            People

              maurizio.cucchiara Maurizio Cucchiara
              ayavorskiy Alex Yavorskiy
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: