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

When a property doesn't exists, the log warn message always misses information

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.3.16.3
    • Fix Version/s: 2.3.24
    • Component/s: Value Stack
    • Labels:
    • Flags:
      Patch

      Description

      As a developer, I write long JSPs and sometimes I make mistakes. For example, i can write the line underneath:

      <s:if test="ghamRestitution.moraHalfFoodFree">blah</s:if>
      

      if the the field "moraHalfFoodFree" doesn't exists on bean "ghamRestitution", XWork raise a warn such as:

      2014/11/25 11:45:08 WARN (CommonsLogger.java:56) warn Could not find property [null]

      The problem is that the message always say "Count not find property [null]" and it's very hard for the developer to know where the bug is in a long JSP.

      com.opensymphony.xwork2.ognl.OgnlValueStack
          private Object handleOgnlException(String expr, boolean throwExceptionOnFailure, OgnlException e) {
              Object ret = findInContext(expr);
              if (ret == null) {
                  if (shouldLogMissingPropertyWarning(e)) {
                      LOG.warn("Could not find property [" + ((NoSuchPropertyException) e).getName() + "]");
                  }
                  if (throwExceptionOnFailure) {
                      throw new XWorkException(e);
                  }
              }
              return ret;
          }
      

      ((NoSuchPropertyException) e).getName()

      always returns null, instead we should use expr parameter which give the right information.

        Attachments

        1. WW-4424.patch
          0.8 kB
          Brendan Le Ny

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              bleny Brendan Le Ny

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment