You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Amit Surana <am...@gmail.com> on 2008/09/09 09:30:23 UTC

org.apache.abdera.model.AtomDate - Needs Tweaking

Hi All,

I have just started looking into Abdera code and planning to contribute to
the Project (if i can).

In RFC4287: Date Consturcts
Section<http://tools.ietf.org/html/rfc4287#section-3.3>,
its mentioned that - A Date construct is an element whose content MUST
conform to the "date-time" production in [RFC3339].  In addition, an
uppercase **"T" character MUST** be used to separate date and time, and an
uppercase **"Z" character MUST** be present in the absence of a numeric time
zone offset.

But in the org.apache.abdera.model.AtomDate Implementation, When the Date is
passed as String, I saw that the PATTERN does not check if the Date Format
entered has T or Z.
I Tested the Pattern in a sample program.
I gave certain WRONG Inputs like -> "2008-09-08A20:00:00B+05:30"  or
"2008-09-08X23:30:00Y", etc
Instead of getting InvalidDateFormat Exception, I got the output as some
Irrelevant date.
I have tweaked the Date Regex Pattern and code which checks if the Input
contains T and Z also.
Please let me know, if I am wrong

PS: Attaching a sample Java Program which has the tweaked version of the
method required for parsing date when passed as String {method: parse(String
Date)}


-- 
Regards,
Amit M Surana

Blog: http://blog.suranaamit.com/
GMF Doc: http://gmfdoc.suranaamit.com/

Re: org.apache.abdera.model.AtomDate - Needs Tweaking

Posted by David Calavera <da...@gmail.com>.
Hi Amit,

could you open a ticket in jira and provide a patch with any test cases?

thank you

On Tue, Sep 9, 2008 at 9:30 AM, Amit Surana <am...@gmail.com> wrote:

>
> Hi All,
>
> I have just started looking into Abdera code and planning to contribute to
> the Project (if i can).
>
> In RFC4287: Date Consturcts Section<http://tools.ietf.org/html/rfc4287#section-3.3>,
> its mentioned that - A Date construct is an element whose content MUST
> conform to the "date-time" production in [RFC3339].  In addition, an
> uppercase **"T" character MUST** be used to separate date and time, and an
> uppercase **"Z" character MUST** be present in the absence of a numeric
> time zone offset.
>
> But in the org.apache.abdera.model.AtomDate Implementation, When the Date
> is passed as String, I saw that the PATTERN does not check if the Date
> Format entered has T or Z.
> I Tested the Pattern in a sample program.
> I gave certain WRONG Inputs like -> "2008-09-08A20:00:00B+05:30"  or
> "2008-09-08X23:30:00Y", etc
> Instead of getting InvalidDateFormat Exception, I got the output as some
> Irrelevant date.
> I have tweaked the Date Regex Pattern and code which checks if the Input
> contains T and Z also.
> Please let me know, if I am wrong
>
> PS: Attaching a sample Java Program which has the tweaked version of the
> method required for parsing date when passed as String {method: parse(String
> Date)}
>
>
> --
> Regards,
> Amit M Surana
>
> Blog: http://blog.suranaamit.com/
> GMF Doc: http://gmfdoc.suranaamit.com/
>



-- 
David Calavera
http://www.thinkincode.net