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

<s:date/> tag doesn't report missing value

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.20
    • Fix Version/s: 2.3.24
    • Component/s: Plugin - Tags
    • Labels:
      None

      Description

      If you pass a value which isn't Date or Calendar, the <s:date/> ignores it and doesn't report any problems. The problem is here

      public boolean end(Writer writer, String body) {
          String msg;
          java.util.Date date = null;
          // find the name on the valueStack
          try {
              //suport Calendar also
              Object dateObject = findValue(name);
              if (dateObject instanceof java.util.Date) {
                  date = (java.util.Date) dateObject;
              } else if(dateObject instanceof Calendar){
                  date = ((Calendar) dateObject).getTime();
              }
          } catch (Exception e) {
              LOG.error("Could not convert object with key '#0' to a java.util.Date instance", name);
          }
      

      there must additional else clause to report missing value, ie:

              if (dateObject instanceof java.util.Date) {
                  date = (java.util.Date) dateObject;
              } else if(dateObject instanceof Calendar){
                  date = ((Calendar) dateObject).getTime();
              } else {
                  LOG.error(...);
              }
      

        Attachments

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              lukaszlenart Lukasz Lenart

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment