[ 
https://issues.apache.org/jira/browse/ABDERA-199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Amit Surana updated ABDERA-199:
-------------------------------

    Attachment: patch.txt

I have tweaked the Date Regex Pattern and code which checks if the Input 
contains T and Z also. 
I am attaching a patch for the issue. 

Sample Examples from Old Code: 
Test1: 
Input: AtomDate.parse("2008-09-08A20:00:00Z+05:30")
Output: Mon Sep 08 05:30:00 IST 2008 

Test2: 
Input: AtomDate.parse("2008-09-08T20:00:00X+05:30")
Output: Tue Sep 09 01:30:00 IST 2008

Test3: 
Input: AtomDate.parse("2008-09-08T20:00:00Z+05:30")
Output: Mon Sep 08 20:00:00 IST 2008 //EXPECTED OUTCOME


Sample Examples AFTER Fixing the Code and Date Regex

Test1: 
Input: AtomDate.parse("2008-09-08A20:00:00Z+05:30")
Output: Exception

Test2: 
Input: AtomDate.parse("2008-09-08T20:00:00X+05:30")
Output: Exception

Test3: 
Input: AtomDate.parse("2008-09-08T20:00:00Z+05:30")
Output: Mon Sep 08 20:00:00 IST 2008 //EXPECTED OUTCOME


> [core] AtomDate does not check for Date Constructs having T & Z  separations 
> between Date and Time 
> ---------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-199
>                 URL: https://issues.apache.org/jira/browse/ABDERA-199
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.4.0
>            Reporter: Amit Surana
>            Priority: Minor
>         Attachments: patch.txt
>
>
> In RFC4287: Date Consturcts Section, 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to