Bug 51847 - [PATCH] Some Junit tests are Locale sensitive and fail if Locale is different from US
[PATCH] Some Junit tests are Locale sensitive and fail if Locale is different...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.5
All All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-09-19 22:27 UTC by benoit.wiart
Modified: 2011-09-28 18:45 UTC (History)
1 user (show)



Attachments
Fix the bug (4.49 KB, text/plain)
2011-09-19 22:27 UTC, benoit.wiart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description benoit.wiart 2011-09-19 22:27:59 UTC
Created attachment 27539 [details]
Fix the bug

Date format in org.apache.jmeter.protocol.http.control.TestCacheManager depends on the jvm default locale.

The patch reuse the httpclient dateutil to format the dates, it's already used for parsing.

Benoit WIART
Comment 1 Sebb 2011-09-19 23:13:46 UTC
What Locale does it fail on?

I don't use Locale.US and I've not seen any failures.
Comment 2 benoit.wiart 2011-09-20 06:43:43 UTC
It should also work with other english languages not only US

Expires date is formatted with the jvm default locale (in makeDate) but is parsed with Locale.US in DateUtil in CacheManager
the expires date should follow rfc 1123

For example with Locale fr_FR
Expires is mar., 20 sept. 2011 06:39:16 GMT
Where it should be Tue, 20 Sep 2011 06:39:16 GMT

Below are the failures

1) testExpiresJava(org.apache.jmeter.protocol.http.control.TestCacheManager)junit.framework.AssertionFailedError: Should find valid entry
     [java] 	at org.apache.jmeter.protocol.http.control.TestCacheManager.testExpiresJava(TestCacheManager.java:191)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] 	at org.apache.jorphan.test.AllTests.main(AllTests.java:233)
     [java] 2) testExpiresHttpClient(org.apache.jmeter.protocol.http.control.TestCacheManager)junit.framework.AssertionFailedError: Should find valid entry
     [java] 	at org.apache.jmeter.protocol.http.control.TestCacheManager.testExpiresHttpClient(TestCacheManager.java:213)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] 	at org.apache.jorphan.test.AllTests.main(AllTests.java:233)
     [java] FAILURES!!!
Comment 3 Philippe Mouawad 2011-09-20 08:21:11 UTC
Hello,
I confirm these failures in French Locale.
Fix works for me.

Regards
Philippe
Comment 4 Sebb 2011-09-20 09:21:40 UTC
Thanks for the report and patch.

I was using an English Locale, which is why I did not see the problem.

Fixed, but without using DateUtil.

URL: http://svn.apache.org/viewvc?rev=1173042&view=rev
Log:
Bug 51847 - Some Junit tests are Locale sensitive and fail if Locale is different from US

Modified:
   jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
   jakarta/jmeter/trunk/xdocs/changes.xml