struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4453) <s:date/> tag doesn't report missing value
Date Thu, 19 Mar 2015 09:06:45 GMT

    [ https://issues.apache.org/jira/browse/WW-4453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14368736#comment-14368736
] 

Hudson commented on WW-4453:
----------------------------

SUCCESS: Integrated in Struts-JDK6-master #904 (See [https://builds.apache.org/job/Struts-JDK6-master/904/])
WW-4453 Reports missing value (lukaszlenart: rev cd0d8de67aacc531dbf2d5a9840b55ff46bcc817)
* core/src/main/java/org/apache/struts2/components/Date.java
* core/src/main/java/org/apache/struts2/components/Component.java


> <s:date/> tag doesn't report missing value
> ------------------------------------------
>
>                 Key: WW-4453
>                 URL: https://issues.apache.org/jira/browse/WW-4453
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.3.20
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>             Fix For: 2.3.22
>
>
> 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
> {code:java}
> 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);
>     }
> {code}
> there must additional {{else}} clause to report missing value, ie:
> {code:java}
>         if (dateObject instanceof java.util.Date) {
>             date = (java.util.Date) dateObject;
>         } else if(dateObject instanceof Calendar){
>             date = ((Calendar) dateObject).getTime();
>         } else {
>             LOG.error(...);
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message