You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Gurkan Erdogdu <gu...@yahoo.com> on 2009/01/07 08:45:48 UTC

Fw: [webbeans-dev] XML Date Type Field Value




----- Forwarded Message ----
From: Gavin King <ga...@hibernate.org>
To: Gurkan Erdogdu <gu...@yahoo.com>
Cc: webbeans-dev@lists.jboss.org
Sent: Wednesday, January 7, 2009 9:25:31 AM
Subject: Re: [webbeans-dev] XML Date Type Field Value

http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html#getDateTimeInstance()

public static final DateFormat getDateTimeInstance()

    Gets the date/time formatter with the default formatting style for
the default locale.

i.e. it is the server locale.

On Wed, Jan 7, 2009 at 5:54 PM, Gurkan Erdogdu <gu...@yahoo.com> wrote:
> Hi;
>
> In Spec says that
> "Date values are parsed by the DateFormat.getDateTimeInstance().parse()."
>
> But it does not specifies any default locale specific information. So one
> format/Locale defined in the XML does not work for other Locales than its
> defined locale. So is there any default formatting/Locale ? (For example :
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")  as a default).
>
> Thanks;
>
> Gurkan
>
>
>
>
>
> _______________________________________________
> webbeans-dev mailing list
> webbeans-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/webbeans-dev
>
>



-- 
Gavin King
gavin.king@gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



      

AW: Fw: [webbeans-dev] XML Date Type Field Value

Posted by Mark Struberg <st...@yahoo.de>.
It seems that the jboss list mod is now back from holidays. My messages have now shown up on the list!  

LieGrue,
strub
----------------------------------------------------------------
“Multiple exclamation marks are a sure sign of a diseased mind!” 
(Sir Terry Pratchett)


--- Mark Struberg <st...@yahoo.de> schrieb am Mi, 7.1.2009:

> Von: Mark Struberg <st...@yahoo.de>
> Betreff: AW: Fw: [webbeans-dev] XML Date Type Field Value
> An: openwebbeans-dev@incubator.apache.org
> Datum: Mittwoch, 7. Januar 2009, 10:22
> Hi Gurkan!
> 
> Thanks for asking Gavin. It was clear to me that
> getDateTimeInstance always uses the servers Locale, but
> thats exactly the problem. 
> 
> I sent an example why this is a problem to the jboss list
> already yesterday in the evening, but my message waits for
> moderator approval, and it seems that the moderator is on
> vacation (sent another mail a few days ago) :(
> 
> My original mail:
> 
> Question about parsing Date fields in XML based metadata
> 
> Hi!
> 
> It's a bit late so please excuse me if my
> thoughts/sentences are a bit weird.
> 
> The web_beans-1.0-pr-spec has the following definition in
> section 9.2.5:
> > The initial value of a field of type java.util.Date or
> > java.util.Calendar is specified using a format that
> can be
> > parsed by
> java.text.DateFormat.getDateTimeInstance().parse().
> 
> Now my question: DateFormat.getDateTimeInstance() is Locale
> aware. This may not always be positive.
> 
> I'm working on international projects, and if I build a
> WAR in vienna (Locale de_AT), and my colleagues in mountain
> view (Locale US) and Bangalore (maybe Locale hi_IN) like to
> deploy it, then it's very likely that they get parsing
> exceptions for e.g. default values provided via web-beans
> XML definition, isn't it?
> 
> Shouldn't we better use e.g. the xs:dateTime format
> like in SOAP?
> http://www.w3.org/TR/xmlschema-2/#dateTime
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
> 
> 
> Another question:
> Let's say  I have a Calendar field in MyWebBean.java.
> Which kind of Calendar should it actually inject?
> GregorianCalendar? Or should it throw a DefinitionException?
> (Generall question about handling of  abstract members)
> 
> LieGrue,
> strub
> ----------------------------------------------------------------
> “Multiple exclamation marks are a sure sign of a diseased
> mind!” 
> (Sir Terry Pratchett)
> 
> 
> --- Gurkan Erdogdu <gu...@yahoo.com> schrieb
> am Mi, 7.1.2009:
> 
> > Von: Gurkan Erdogdu <gu...@yahoo.com>
> > Betreff: Fw: [webbeans-dev] XML Date Type Field Value
> > An: "Mark Struberg"
> <st...@yahoo.de>
> > CC: openwebbeans-dev@incubator.apache.org
> > Datum: Mittwoch, 7. Januar 2009, 8:45
> > ----- Forwarded Message ----
> > From: Gavin King <ga...@hibernate.org>
> > To: Gurkan Erdogdu <gu...@yahoo.com>
> > Cc: webbeans-dev@lists.jboss.org
> > Sent: Wednesday, January 7, 2009 9:25:31 AM
> > Subject: Re: [webbeans-dev] XML Date Type Field Value
> > 
> >
> http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html#getDateTimeInstance()
> > 
> > public static final DateFormat getDateTimeInstance()
> > 
> >     Gets the date/time formatter with the default
> > formatting style for
> > the default locale.
> > 
> > i.e. it is the server locale.
> > 
> > On Wed, Jan 7, 2009 at 5:54 PM, Gurkan Erdogdu
> > <gu...@yahoo.com> wrote:
> > > Hi;
> > >
> > > In Spec says that
> > > "Date values are parsed by the
> > DateFormat.getDateTimeInstance().parse()."
> > >
> > > But it does not specifies any default locale
> specific
> > information. So one
> > > format/Locale defined in the XML does not work
> for
> > other Locales than its
> > > defined locale. So is there any default
> > formatting/Locale ? (For example :
> > >
> >
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
> >  as a default).
> > >
> > > Thanks;
> > >
> > > Gurkan


      

AW: Fw: [webbeans-dev] XML Date Type Field Value

Posted by Mark Struberg <st...@yahoo.de>.
Hi Gurkan!

Thanks for asking Gavin. It was clear to me that getDateTimeInstance always uses the servers Locale, but thats exactly the problem. 

I sent an example why this is a problem to the jboss list already yesterday in the evening, but my message waits for moderator approval, and it seems that the moderator is on vacation (sent another mail a few days ago) :(

My original mail:

Question about parsing Date fields in XML based metadata

Hi!

It's a bit late so please excuse me if my thoughts/sentences are a bit weird.

The web_beans-1.0-pr-spec has the following definition in section 9.2.5:
> The initial value of a field of type java.util.Date or
> java.util.Calendar is specified using a format that can be
> parsed by java.text.DateFormat.getDateTimeInstance().parse().

Now my question: DateFormat.getDateTimeInstance() is Locale aware. This may not always be positive.

I'm working on international projects, and if I build a WAR in vienna (Locale de_AT), and my colleagues in mountain view (Locale US) and Bangalore (maybe Locale hi_IN) like to deploy it, then it's very likely that they get parsing exceptions for e.g. default values provided via web-beans XML definition, isn't it?

Shouldn't we better use e.g. the xs:dateTime format like in SOAP?
http://www.w3.org/TR/xmlschema-2/#dateTime
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");


Another question:
Let's say  I have a Calendar field in MyWebBean.java. Which kind of Calendar should it actually inject? GregorianCalendar? Or should it throw a DefinitionException? (Generall question about handling of  abstract members)

LieGrue,
strub
----------------------------------------------------------------
“Multiple exclamation marks are a sure sign of a diseased mind!” 
(Sir Terry Pratchett)


--- Gurkan Erdogdu <gu...@yahoo.com> schrieb am Mi, 7.1.2009:

> Von: Gurkan Erdogdu <gu...@yahoo.com>
> Betreff: Fw: [webbeans-dev] XML Date Type Field Value
> An: "Mark Struberg" <st...@yahoo.de>
> CC: openwebbeans-dev@incubator.apache.org
> Datum: Mittwoch, 7. Januar 2009, 8:45
> ----- Forwarded Message ----
> From: Gavin King <ga...@hibernate.org>
> To: Gurkan Erdogdu <gu...@yahoo.com>
> Cc: webbeans-dev@lists.jboss.org
> Sent: Wednesday, January 7, 2009 9:25:31 AM
> Subject: Re: [webbeans-dev] XML Date Type Field Value
> 
> http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html#getDateTimeInstance()
> 
> public static final DateFormat getDateTimeInstance()
> 
>     Gets the date/time formatter with the default
> formatting style for
> the default locale.
> 
> i.e. it is the server locale.
> 
> On Wed, Jan 7, 2009 at 5:54 PM, Gurkan Erdogdu
> <gu...@yahoo.com> wrote:
> > Hi;
> >
> > In Spec says that
> > "Date values are parsed by the
> DateFormat.getDateTimeInstance().parse()."
> >
> > But it does not specifies any default locale specific
> information. So one
> > format/Locale defined in the XML does not work for
> other Locales than its
> > defined locale. So is there any default
> formatting/Locale ? (For example :
> >
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
>  as a default).
> >
> > Thanks;
> >
> > Gurkan