Modello

Xpp3GeneratorTest failed for date format on french system

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.0-alpha-11
  • Fix Version/s: 1.0-alpha-11
  • Component/s: modello-plugin-xpp3
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    3

Description

We need to specify a default Locale to verify the date format.

Here is the full surefire report:

 
-------------------------------------------------------------------------------
Test set: org.codehaus.modello.generator.xml.xpp3.Xpp3GeneratorTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.626 sec <<< FAILURE!
xpp3(org.codehaus.modello.generator.xml.xpp3.Xpp3GeneratorTest)  Time elapsed: 3.564 sec  <<< FAILURE!
junit.framework.ComparisonFailure: expected:<...Friday, 6 January 2006 12:00:00 AM...> but was:<...vendredi 6 janvier 2006 0 h 00...>
	at junit.framework.Assert.assertEquals(Assert.java:81)
	at junit.framework.Assert.assertEquals(Assert.java:87)
	at org.codehaus.modello.generator.xml.xpp3.Xpp3Verifier.verifyWriter(Xpp3Verifier.java:245)
	at org.codehaus.modello.generator.xml.xpp3.Xpp3Verifier.verify(Xpp3Verifier.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.codehaus.modello.AbstractModelloGeneratorTest.verify(AbstractModelloGeneratorTest.java:200)
	at org.codehaus.modello.generator.xml.xpp3.Xpp3GeneratorTest.testXpp3Generator(Xpp3GeneratorTest.java:126)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:261)
	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:781)
  1. MODELLO-51.diff
    03/Aug/06 2:39 PM
    0.9 kB
    Vincent Siveton
  2. MODELLO51-modello-plugin-xpp3.patch
    03/Aug/06 10:43 AM
    2 kB
    Denis Cabasson
  3. MODELLO51-modello-plugin-xpp3-2.patch
    04/Aug/06 2:17 AM
    5 kB
    Denis Cabasson

Issue Links

Activity

Hide
Denis Cabasson added a comment -

Patch provided to correct this.

Date is always written in US Locale, and expected.xml file has been updated to comply with this Locale.

Show
Denis Cabasson added a comment - Patch provided to correct this. Date is always written in US Locale, and expected.xml file has been updated to comply with this Locale.
Hide
Vincent Siveton added a comment -

Your patch doesn't work due to the same timezone problem

You are in France, so Central European Time (CET) with daylight savings (CEST). I am in America/New_York timezone (Eastern Standard Time, EST)
Brett is in Australia and I think that adding Australia locale as default in the jvm is enough.

Show
Vincent Siveton added a comment - Your patch doesn't work due to the same timezone problem You are in France, so Central European Time (CET) with daylight savings (CEST). I am in America/New_York timezone (Eastern Standard Time, EST) Brett is in Australia and I think that adding Australia locale as default in the jvm is enough.
Hide
Denis Cabasson added a comment -

I not completly happy with your solution. That mean that one person, serializing its model in a given Locale won't be able to handle the xml file to someone else in another Locale.

That's not satisfying, from my point of view.

Here is another path, providing the following:

  • Reader / Writer use Locale.US to read and write date. This way, no problem with the user Locale.
  • For test purpose, we assert TimeZone America/New_York as default, so that dates are written as expected.

To me this solution would be more convenient (test is working here as well, when I'm changing my Locale).

Show
Denis Cabasson added a comment - I not completly happy with your solution. That mean that one person, serializing its model in a given Locale won't be able to handle the xml file to someone else in another Locale. That's not satisfying, from my point of view. Here is another path, providing the following:
  • Reader / Writer use Locale.US to read and write date. This way, no problem with the user Locale.
  • For test purpose, we assert TimeZone America/New_York as default, so that dates are written as expected.
To me this solution would be more convenient (test is working here as well, when I'm changing my Locale).
Hide
Arnaud Heritier added a comment -

Patch applied. Thx Denis.

Show
Arnaud Heritier added a comment - Patch applied. Thx Denis.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: