Summary: | [PATCH] Some Junit tests are Locale sensitive and fail if Locale is different from US | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | benoit.wiart |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | p.mouawad |
Priority: | P2 | ||
Version: | 2.5 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Fix the bug |
What Locale does it fail on? I don't use Locale.US and I've not seen any failures. 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!!! Hello, I confirm these failures in French Locale. Fix works for me. Regards Philippe 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 This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2549 |
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