You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Kevin Brown (JIRA)" <ji...@apache.org> on 2008/07/11 06:13:38 UTC

[jira] Closed: (SHINDIG-445) Invalid Date: header from remote server shouldn't cause null pointer exception

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

Kevin Brown closed SHINDIG-445.
-------------------------------

    Resolution: Fixed

Please sync your client and subscribe to shindig-commits and shindig-issues. This issue was addressed several days ago.

> Invalid Date: header from remote server shouldn't cause null pointer exception
> ------------------------------------------------------------------------------
>
>                 Key: SHINDIG-445
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-445
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Gadget Rendering Server (Java)
>            Reporter: John Hjelmstad
>            Priority: Minor
>         Attachments: httpresp.patch
>
>
> I've recently encountered a server which returns an invalid HTTP/1.1 Date header:
> Date: Thu, 10 Jul 2008 22:54:20 EDT
> Per (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1), Date must be specified in GMT. Shindig's implementation is in line with this requirement.
> Shindig Java's implementation causes an NPE with this input due to the following code:
> DateUtil.java:
>   public static Date parseDate(String dateStr) {
>     try {
>       return rfc1123DateFormat.parseDateTime(dateStr).toDate();
>     } catch (Exception e) {
>       // Don't care.
>       return null;
>     }
>   }
> Used here:
>   return DateUtil.parseDate(date).getTime();
> I'm inclined to give poor caching characteristics to such inputs rather than NPE altogether, which offers a poor/confusing developer experience, in particular returning 0 when the Date returned from parseDate is invalid. Thoughts?

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