--- Niall Pemberton <[EMAIL PROTECTED]> wrote:

> On Nov 13, 2007 9:53 PM, Matt Benson
> <[EMAIL PROTECTED]> wrote:
> > What this says to me is that
> > DateFormat.getTimeInstance(int, Locale) is buggy
> in
> > that the full/long time formatting pattern is at
> least
> > partially dependent upon the default Locale even
> when
> > the Locale is specified explicitly by the method
> > signature.  MF is explicit enough about its
> > implementation details that EMF has inherited the
> > behavior, which is probably for the best, all
> things
> > considered.  I think your fix is fine here.
> 
> OK I wasn't proposing that as a fix as I don't know
> the code - just as
> evidence to point to where the problem lay  - so I
> took a closer look
> at this with a debugger. I believe your assumption
> about
> DateFormat.getTimeInstance(int, Locale) is incorrect
> (i.e. that its
> buggy). Looks to me like the problem is with the
> testLongTime() and
> testFullTime() methods in AbstractMessageFormatTest
> - they use
> DateFormat.getTimeInstance(int) rather than
> DateFormat.getTimeInstance(int, Locale) to format
> the dates in the
> expected results - so rather than the fix you
> applied, I would sugges
> something the following:
> 
>      public void testLongTime() {
> -        DateFormat df =
> DateFormat.getTimeInstance(DateFormat.LONG);
> +        DateFormat df =
> DateFormat.getTimeInstance(DateFormat.LONG,
> Locale.US);
>          StringBuffer expected = new StringBuffer();
>          for (int i = 0; i < DATES.length; i++) {
>              if (i > 0) {
> @@ -228,7 +227,7 @@
>      }
> 
>      public void testFullTime() {
> -        DateFormat df =
> DateFormat.getTimeInstance(DateFormat.FULL);
> +        DateFormat df =
> DateFormat.getTimeInstance(DateFormat.FULL,
> Locale.US);
>          StringBuffer expected = new StringBuffer();
> 

Have you verified that works for you?  Obviously your
reasoning is spot on; I had forgotten I relied on code
for those!  :(

-Matt

> Niall
> 
> > -Matt
> >
> > --- Ben Speakmon <[EMAIL PROTECTED]> wrote:
> >
> > > What I know now, and what surprised me, was that
> > > passing user.language
> > > and user.region (or user.country) did not
> actually
> > > change the default
> > > Locale from junit's point of view, though it did
> > > change at least the
> > > default date formatting. Though now that I think
> of
> > > it, maybe doing it
> > > that way doesn't actually pass through to the
> test
> > > goal if it's run in
> > > a different classloader. Dunno how, or if,
> that's
> > > related to your
> > > MessageFormat.
> > >
> > > On Nov 13, 2007 1:28 PM, Matt Benson
> > > <[EMAIL PROTECTED]> wrote:
> > > > Does anyone care to corroborate my opinion,
> then,
> > > that
> > > > java.text.MessageFormat's (String, Locale)
> > > constructor
> > > > must yield a buggy object instance, then?
> > > >
> > > > -Matt
> > > >
> > > >
> > > >
> > > > --- Ben Speakmon <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > Well that settles that :) Apparently you
> can't
> > > set
> > > > > the locale from the
> > > > > command line, just the language and region.
> > > weird.
> > > > >
> > > > > I'll check in that change.
> > > > >
> > > > > On Nov 13, 2007 1:10 PM, Niall Pemberton
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Well I threw the following line into the
> > > setup()
> > > > > method of
> > > > > > AbstractMessageFormatTest and the errors
> go
> > > away.
> > > > > >
> > > > > >
> > > > >
> > >
> java.util.Locale.setDefault(java.util.Locale.US);
> > > > > >
> > > > > > Niall
> > > > > >
> > > > > >
> > > > > > On Nov 13, 2007 8:17 PM, Matt Benson
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > Rather, I created the tests to
> explicitly
> > > use
> > > > > > > Locale.US so that there were no
> assumptions
> > > wrt
> > > > > > > default Locale; I will certainly be
> > > > > double-checking
> > > > > > > these.  :|
> > > > > > >
> > > > > > > -Matt
> > > > > > >
> > > > > > >
> > > > > > > --- Niall Pemberton
> > > <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > >
> > > > > > > > My guess from just looking at the test
> > > output
> > > > > is
> > > > > > > > that theres an
> > > > > > > > assumption in the test that the
> default
> > > Locale
> > > > > is
> > > > > > > > US. If that is the
> > > > > > > > case then these tests should set the
> > > default
> > > > > locale
> > > > > > > > to Locale.US
> > > > > > > > before executing.
> > > > > > > >
> > > > > > > > Niall
> > > > > > > >
> > > > > > > > On Nov 13, 2007 7:38 PM, Ben Speakmon
> > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > Odd. WFM on my ubuntu with Java 1.4
> and
> > > 5.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Nov 13, 2007 11:31 AM, Niall
> > > Pemberton
> > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > I just tried running "maven test"
> for
> > > > > Commons
> > > > > > > > Lang and the
> > > > > > > > > > TextTestSuite had a bunch of
> failures.
> > > I
> > > > > don't
> > > > > > > > really have time to
> > > > > > > > > > look into this at the moment.
> > > > > > > > > >
> > > > > > > > > > Niall
> > > > > > > > > >
> > > > > > > > > > Testcase:
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
testLongTime(org.apache.commons.lang.text.MessageFormatTest):
> > > > > > > > FAILED
> > > > > > > > > > expected:<...00:15:20 GMT; Time 1:
> > > > > 12:30:35 GMT;
> > > > > > > > Time 2: 18:45:50...>
> > > > > > > > > > but was:<...12:15:20 AM GMT; Time
> 1:
> > > > > 12:30:35 PM
> > > > > > > > GMT; Time 2: 6:45:50
> > > > > > > > > > PM...>
> > > > > > > > > > junit.framework.ComparisonFailure:
> > > > > > > > expected:<...00:15:20 GMT; Time 1:
> > > > > > > > > > 12:30:35 GMT; Time 2: 18:45:50...>
> but
> > > > > > > > was:<...12:15:20 AM GMT; Time
> > > > > > > > > > 1: 12:30:35 PM GMT; Time 2:
> 6:45:50
> > > PM...>
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:64)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:58)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.testLongTime(AbstractMessageFormatTest.java:222)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > Method)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Testcase:
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
testFullTime(org.apache.commons.lang.text.MessageFormatTest):
> > > > > > > > FAILED
> > > > > > > > > > expected:<...00:15:20 o'clock GMT;
> > > Time 1:
> > > > > > > > 12:30:35 o'clock GMT; Time
> > > > > > > > > > 2: 18:45:50 o'clock...> but
> > > > > was:<...12:15:20 AM
> > > > > > > > GMT; Time 1: 12:30:35
> > > > > > > > > > PM GMT; Time 2: 6:45:50 PM...>
> > > > > > > > > > junit.framework.ComparisonFailure:
> > > > > > > > expected:<...00:15:20 o'clock GMT;
> > > > > > > > > > Time 1: 12:30:35 o'clock GMT; Time
> 2:
> > > > > 18:45:50
> > > > > > > > o'clock...> but
> > > > > > > > > > was:<...12:15:20 AM GMT; Time 1:
> > > 12:30:35
> > > > > PM
> > > > > > > > GMT; Time 2: 6:45:50
> > > > > > > > > > PM...>
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:64)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.testFullTime(AbstractMessageFormatTest.java:238)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > Method)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Testcase:
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
testLongTime(org.apache.commons.lang.text.ExtendedMessageFormatBaselineTest):
> > > > > > > > FAILED
> > > > > > > > > > expected:<...00:15:20 GMT; Time 1:
> > > > > 12:30:35 GMT;
> > > > > > > > Time 2: 18:45:50...>
> > > > > > > > > > but was:<...12:15:20 AM GMT; Time
> 1:
> > > > > 12:30:35 PM
> > > > > > > > GMT; Time 2: 6:45:50
> > > > > > > > > > PM...>
> > > > > > > > > > junit.framework.ComparisonFailure:
> > > > > > > > expected:<...00:15:20 GMT; Time 1:
> > > > > > > > > > 12:30:35 GMT; Time 2: 18:45:50...>
> but
> > > > > > > > was:<...12:15:20 AM GMT; Time
> > > > > > > > > > 1: 12:30:35 PM GMT; Time 2:
> 6:45:50
> > > PM...>
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:64)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:58)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.testLongTime(AbstractMessageFormatTest.java:222)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > Method)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Testcase:
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
testFullTime(org.apache.commons.lang.text.ExtendedMessageFormatBaselineTest):
> > > > > > > > FAILED
> > > > > > > > > > expected:<...00:15:20 o'clock GMT;
> > > Time 1:
> > > > > > > > 12:30:35 o'clock GMT; Time
> > > > > > > > > > 2: 18:45:50 o'clock...> but
> > > > > was:<...12:15:20 AM
> > > > > > > > GMT; Time 1: 12:30:35
> > > > > > > > > > PM GMT; Time 2: 6:45:50 PM...>
> > > > > > > > > > junit.framework.ComparisonFailure:
> > > > > > > > expected:<...00:15:20 o'clock GMT;
> > > > > > > > > > Time 1: 12:30:35 o'clock GMT; Time
> 2:
> > > > > 18:45:50
> > > > > > > > o'clock...> but
> > > > > > > > > > was:<...12:15:20 AM GMT; Time 1:
> > > 12:30:35
> > > > > PM
> > > > > > > > GMT; Time 2: 6:45:50
> > > > > > > > > > PM...>
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:64)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.testFullTime(AbstractMessageFormatTest.java:238)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > Method)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Testcase:
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
testLongTime(org.apache.commons.lang.text.MessageFormatExtensionTest):
> > > > > > > >        FAILED
> > > > > > > > > > expected:<...00:15:20 GMT; Time 1:
> > > > > 12:30:35 GMT;
> > > > > > > > Time 2: 18:45:50...>
> > > > > > > > > > but was:<...12:15:20 AM GMT; Time
> 1:
> > > > > 12:30:35 PM
> > > > > > > > GMT; Time 2: 6:45:50
> > > > > > > > > > PM...>
> > > > > > > > > > junit.framework.ComparisonFailure:
> > > > > > > > expected:<...00:15:20 GMT; Time 1:
> > > > > > > > > > 12:30:35 GMT; Time 2: 18:45:50...>
> but
> > > > > > > > was:<...12:15:20 AM GMT; Time
> > > > > > > > > > 1: 12:30:35 PM GMT; Time 2:
> 6:45:50
> > > PM...>
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:64)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:58)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.testLongTime(AbstractMessageFormatTest.java:222)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > Method)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Testcase:
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
testFullTime(org.apache.commons.lang.text.MessageFormatExtensionTest):
> > > > > > > >        FAILED
> > > > > > > > > > expected:<...00:15:20 o'clock GMT;
> > > Time 1:
> > > > > > > > 12:30:35 o'clock GMT; Time
> > > > > > > > > > 2: 18:45:50 o'clock...> but
> > > > > was:<...12:15:20 AM
> > > > > > > > GMT; Time 1: 12:30:35
> > > > > > > > > > PM GMT; Time 2: 6:45:50 PM...>
> > > > > > > > > > junit.framework.ComparisonFailure:
> > > > > > > > expected:<...00:15:20 o'clock GMT;
> > > > > > > > > > Time 1: 12:30:35 o'clock GMT; Time
> 2:
> > > > > 18:45:50
> > > > > > > > o'clock...> but
> > > > > > > > > > was:<...12:15:20 AM GMT; Time 1:
> > > 12:30:35
> > > > > PM
> > > > > > > > GMT; Time 2: 6:45:50
> > > > > > > > > > PM...>
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.doAssertions(AbstractMessageFormatTest.java:64)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.commons.lang.text.AbstractMessageFormatTest.testFullTime(AbstractMessageFormatTest.java:238)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > Method)
> > > > > > > > > >         at
> > > > > > > >
> > > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >         at
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > > > > > > Source)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > > > > For additional commands, e-mail:
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > > > For additional commands, e-mail:
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > > For additional commands, e-mail:
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
____________________________________________________________________________________
> > > > > > > Be a better sports nut!  Let your teams
> > > follow
> > > > > you
> > > > > > > with Yahoo Mobile. Try it now.
> > > > >
> > > >
> > >
> >
>
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > > > For additional commands, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
____________________________________________________________________________________
> > > > Get easy, one-click access to your favorites.
> > > > Make Yahoo! your homepage.
> > > > http://www.yahoo.com/r/hs
> > > >
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> >      
>
____________________________________________________________________________________
> > Be a better pen pal.
> > Text or chat with friends inside Yahoo! Mail. See
> how.  http://overview.mail.yahoo.com/
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



      
____________________________________________________________________________________
Be a better sports nut!  Let your teams follow you 
with Yahoo Mobile. Try it now.  
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to