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 <[email protected]> schrieb am Mi, 7.1.2009: > Von: Gurkan Erdogdu <[email protected]> > Betreff: Fw: [webbeans-dev] XML Date Type Field Value > An: "Mark Struberg" <[email protected]> > CC: [email protected] > Datum: Mittwoch, 7. Januar 2009, 8:45 > ----- Forwarded Message ---- > From: Gavin King <[email protected]> > To: Gurkan Erdogdu <[email protected]> > Cc: [email protected] > 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 > <[email protected]> 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
