PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

RFC 822 dates should use English in any locale #117

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the unit tests with a default locale where the language is not English.

What is the expected output? What do you see instead?

Six unit tests fail due to errors in expected date strings:

com.google.enterprise.connector.pusher.DocPusherTest:
    testTakeIsPublic
    testSimpleDoc
    testSimpleDeleteDoc
    testWordDoc
    testFeedLogging

com.google.enterprise.connector.spi.ValueTest:
    testCalendarToRfc822

Please use labels and text to provide additional information.

Setting a different language for the default locale varies by JDK and platform. 
On Mac OS X, 
setting the user.language Java system property in the run_tests junit task 
works, as does setting 
LC_ALL on the Ant command line (e.g., "LC_ALL=es_ES ant run_tests").

Originally reported by jloramas, 2008-05-08.

Original issue reported on code.google.com by jl1615@gmail.com on 14 Jan 2009 at 1:45

GoogleCodeExporter commented 8 years ago

Original comment by mgron...@gmail.com on 6 May 2009 at 9:50

GoogleCodeExporter commented 8 years ago
I think the error here is actually in the software rather than the tests. RFC 
822 dates are English-only. We should 
be using the ENGLISH or US locale for RFC 822 date formatting, and something 
else in the tests.

I don't know the severity of this, because I don't know if the GSA actually 
handles non-English RFC 822 dates 
(whatever that might mean, really).

Original comment by jl1615@gmail.com on 14 May 2009 at 5:45

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi, 

Yes, the problem is from the software. 

A quick fix we use : 

private static final SimpleDateFormat RFC822_DATE_FORMAT = new
SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss z");

To : 

private static final SimpleDateFormat RFC822_DATE_FORMAT = new
SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss z", Locale.ENGLISH);

Works well here. 

See attached file for example. 

Regards, 

Nicolas Bélisle
Constellio team

Original comment by nicolas....@gtempaccount.com on 4 Aug 2009 at 6:29

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by jl1615@gmail.com on 24 Oct 2009 at 3:00

GoogleCodeExporter commented 8 years ago
Fixed in r2303. We are using Locale.ENGLISH in the date format.

Original comment by jl1615@gmail.com on 26 Oct 2009 at 5:26

GoogleCodeExporter commented 8 years ago

Original comment by jl1615@gmail.com on 27 Oct 2009 at 11:05