Nathan,

On 10/29/2009 10:36 AM, Nathan Bubna wrote:
>>        return df.toLocalizedPattern();
> 
> I believe you'll have to cast to (SimpleDateFormat) to get the
> toLocalizedPattern() method.

Yup, I noticed that as I started to write the code. For now, I just have
it allowing a ClassCastException. I wasn't sure what to do if the
DateFormat returned wasn't a SimpleDateFormat. I suppose I could always
re-code whatever DateFormat comes back into a SimpleDateFormat and use
that. That ought to always work, even if it ends up being a bit slow.

> In practice, such a cast should always
> work, but i don't trust that.  So, perhaps cast, but try/catch any
> ClassCastException and return null (or attempt your original plan in
> such cases.

I like re-coding into SimpleDataFormat better.

I'm working on unit tests right now and everything looks good, including
the use of special formats such as 'short_time' and stuff like that.

I'll also fix the direct-access of the 'timezone' member when I'm
finished with this.

-chris

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to