You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/07/07 02:09:25 UTC

svn commit: r1751741 - /poi/trunk/src/testcases/org/apache/poi/util/TestLocaleUtil.java

Author: onealj
Date: Thu Jul  7 02:09:25 2016
New Revision: 1751741

URL: http://svn.apache.org/viewvc?rev=1751741&view=rev
Log:
bug 59805: tearDown should reset, not set, the LocaleUtil ThreadLocals (also avoid memory leaks)

Modified:
    poi/trunk/src/testcases/org/apache/poi/util/TestLocaleUtil.java

Modified: poi/trunk/src/testcases/org/apache/poi/util/TestLocaleUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestLocaleUtil.java?rev=1751741&r1=1751740&r2=1751741&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestLocaleUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestLocaleUtil.java Thu Jul  7 02:09:25 2016
@@ -40,16 +40,12 @@ public class TestLocaleUtil {
     /**
      * Reset the Locale to the user default before the test so that it isn't influenced
      * by the LocaleUtil's state being changed by previous tests.
-     * 
-     * Reset the Locale to the user default after the test so that it doesn't influence
-     * other tests.
      */
     @Before
-    @After
     @SuppressForbidden("implementation around default locales in POI")
-    public void reset() {
-        // clear the user locale and time zone so that tests do not interfere with each other
-        // the other way and better way would be to run each test in its own thread since
+    public void setUp() {
+        // reset the user locale and time zone so that tests do not interfere with each other
+        // the other and better way would be to run each test in its own thread since
         // LocaleUtil uses per-thread settings.
         // Helpful, but not ASL 2.0 licensed:
         // http://www.codeaffine.com/2014/07/21/a-junit-rule-to-run-a-test-in-its-own-thread/
@@ -59,6 +55,16 @@ public class TestLocaleUtil {
         assumeFalse(ja_JP.equals(LocaleUtil.getUserLocale()));
         assumeFalse(TOKYO.equals(LocaleUtil.getUserTimeZone()));
     }
+
+    /**
+     * Reset the Locale to the user default after the test so that it doesn't influence
+     * other tests.
+     */
+    @After
+    public void tearDown() {
+        LocaleUtil.resetUserLocale();
+        LocaleUtil.resetUserTimeZone();
+    }
     
     @Test
     @SuppressForbidden("implementation around default locales in POI")



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org