abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Berry <chriswbe...@gmail.com>
Subject AtomDate
Date Wed, 09 Jan 2008 03:54:36 GMT

The AtomDate class is not adhering to the RFC3339 spec (see below)   
IIRC, this is somewhat by design??

But unfortunately, it its current state the regex PATTERN in AtomDate

     private static final Pattern PATTERN = Pattern.compile(

allows dates like this:: "12012007" to be interpreted as::   
'1200-12-31 18:00:00.0' in the CST timezone.
Obviously the caller should have used "20071201".
But it seems to me that Abdera should be strict about these dates  
(and adhere strictly to the spec)?? (e.g. "2007-12-01")
Otherwise these dates (and thus, errors) can slip through the cracks.  
(In my case to be rejected eventually by the database)

So you could use something like this;

    private static final Pattern PATTERN = Pattern.compile(

  Or better, if you want to be even more specific and restrict month  
and day numbers correctly...

     private static final Pattern PATTERN = Pattern.compile(

NOTE: I have not entirely corrected PATTERN. Only the Date portion.

-- Chris 

RFC 3339       Date and Time on the Internet: Timestamps       July 2002

5.6. Internet Date/Time Format

    The following profile of ISO 8601 [ISO8601] dates SHOULD be used in
    new protocols on the Internet.  This is specified using the syntax
    description notation defined in [ABNF].

    date-fullyear   = 4DIGIT
    date-month      = 2DIGIT  ; 01-12
    date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on
                              ; month/year
    time-hour       = 2DIGIT  ; 00-23
    time-minute     = 2DIGIT  ; 00-59
    time-second     = 2DIGIT  ; 00-58, 00-59, 00-60 based on leap second
                              ; rules
    time-secfrac    = "." 1*DIGIT
    time-numoffset  = ("+" / "-") time-hour ":" time-minute
    time-offset     = "Z" / time-numoffset

    partial-time    = time-hour ":" time-minute ":" time-second
    full-date       = date-fullyear "-" date-month "-" date-mday
    full-time       = partial-time time-offset

    date-time       = full-date "T" full-time

       NOTE: Per [ABNF] and ISO8601, the "T" and "Z" characters in this
       syntax may alternatively be lower case "t" or "z" respectively.

       This date/time format may be used in some environments or  
       that distinguish between the upper- and lower-case letters  
       and 'a'-'z' (e.g. XML).  Specifications that use this format in
       such environments MAY further limit the date/time syntax so that
       the letters 'T' and 'Z' used in the date/time syntax must always
       be upper case.  Applications that generate this format SHOULD use
       upper case letters.

       NOTE: ISO 8601 defines date and time separated by "T".
       Applications using this syntax may choose, for the sake of
       readability, to specify a full-date and full-time separated by
       (say) a space character.

S'all good  ---   chriswberry at gmail dot com

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message