cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28360] - [PATCH] DateInputModule's getAttribute() does not fetch requested format
Date Thu, 28 Oct 2004 12:47:20 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28360>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28360

[PATCH] DateInputModule's getAttribute() does not fetch requested format





------- Additional Comments From nverwer@email.com  2004-10-28 12:47 -------
In order to preserve backwards-compatibility, getting the format from the
configuration *must* be supported.
One might, however, want to extend this module, allowing the use of the
attribute-name if the format is not specified otherwise.

The code change comes down to 3 characters (null -> name):

    public Object getAttribute( String name, Configuration modeConf, Map
objectModel ) throws ConfigurationException {
        
        String format = (String) this.settings.get("format",name);
        if (modeConf != null) {
            format = modeConf.getAttribute("format", format);
            // this is preferred:
            format = modeConf.getChild("format").getValue(format);
        }

        if (format==null) {
            return new Date();
        } else {
            return new SimpleDateFormat(format).format(new Date());
        }
    }

Oh, yes, the documentation needs to be changed as well if this change is accepted.

Mime
View raw message