Author: mbrohl
Date: Fri Dec 8 21:05:00 2017 New Revision: 1817568 URL: http://svn.apache.org/viewvc?rev=1817568&view=rev Log: Improved: Fixing defects reported by FindBugs, package org.apache.ofbiz.base.util.test. (OFBIZ-9722) Thanks Julian Leichert for reporting and providing the patch. Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilPropertiesTests.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java?rev=1817568&r1=1817567&r2=1817568&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java Fri Dec 8 21:05:00 2017 @@ -316,7 +316,7 @@ public class ObjectTypeTests extends Gen public void testDouble() throws GeneralException { simpleTypeConvertTestSingleMulti("Double->String", Double.valueOf("1234567"), new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567"); simpleTypeConvertTestSingleMulti("Double->BigDecimal", dbl, new String[] {"BigDecimal", "java.math.BigDecimal"}, dcml); - simpleTypeConvertTestSingleMulti("Double->Double", dbl, new String[] {"Double", "java.lang.Double"}, new Double("781.25")); + simpleTypeConvertTestSingleMulti("Double->Double", dbl, new String[] {"Double", "java.lang.Double"}, Double.valueOf("781.25")); simpleTypeConvertTestSingleMulti("Double->Float", dbl, new String[] {"Float", "java.lang.Float"}, flt); simpleTypeConvertTestSingleMulti("Double->Long", dbl, new String[] {"Long", "java.lang.Long"}, lng); simpleTypeConvertTestSingleMulti("Double->Integer", dbl, new String[] {"Integer", "java.lang.Integer"}, intg); @@ -331,7 +331,7 @@ public class ObjectTypeTests extends Gen simpleTypeConvertTestSingleMulti("Float->String", Float.valueOf("1234567"), new String[] {"String"}, null, localeData, "1,234,567"); simpleTypeConvertTestSingleMulti("Float->BigDecimal", flt, new String[] {"BigDecimal", "java.math.BigDecimal"}, dcml); simpleTypeConvertTestSingleMulti("Float->Double", flt, new String[] {"Double", "java.lang.Double"}, dbl); - simpleTypeConvertTestSingleMulti("Float->Float", flt, new String[] {"Float", "java.lang.Float"}, new Float("781.25")); + simpleTypeConvertTestSingleMulti("Float->Float", flt, new String[] {"Float", "java.lang.Float"}, Float.valueOf("781.25")); simpleTypeConvertTestSingleMulti("Float->Long", flt, new String[] {"Long", "java.lang.Long"}, lng); simpleTypeConvertTestSingleMulti("Float->Integer", flt, new String[] {"Integer", "java.lang.Integer"}, intg); simpleTypeConvertTestSingleMulti("Float->List", flt, new String[] {"List", "List<java.lang.Float>", "java.util.List"}, list(flt)); @@ -343,9 +343,9 @@ public class ObjectTypeTests extends Gen public void testLong() throws GeneralException { simpleTypeConvertTestSingleMulti("Long->String", Long.valueOf("1234567"), new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567"); simpleTypeConvertTestSingleMulti("Long->BigDecimal", lng, new String[] {"BigDecimal", "java.math.BigDecimal"}, new BigDecimal("781")); - simpleTypeConvertTestSingleMulti("Long->Double", lng, new String[] {"Double", "java.lang.Double"}, new Double("781")); - simpleTypeConvertTestSingleMulti("Long->Float", lng, new String[] {"Float", "java.lang.Float"}, new Float("781")); - simpleTypeConvertTestSingleMulti("Long->Long", lng, new String[] {"Long", "java.lang.Long"}, new Long("781")); + simpleTypeConvertTestSingleMulti("Long->Double", lng, new String[] { "Double", "java.lang.Double" }, Double.valueOf("781")); + simpleTypeConvertTestSingleMulti("Long->Float", lng, new String[] { "Float", "java.lang.Float" }, Float.valueOf("781")); + simpleTypeConvertTestSingleMulti("Long->Long", lng, new String[] { "Long", "java.lang.Long" }, Long.valueOf("781")); simpleTypeConvertTestSingleMulti("Long->Integer", lng, new String[] {"Integer", "java.lang.Integer"}, intg); simpleTypeConvertTestSingleMulti("Long->List", lng, new String[] {"List", "List<java.lang.Long>", "java.util.List"}, list(lng)); simpleTypeConvertTestSingleMulti("Long->Set", lng, new String[] {"Set", "Set<java.lang.Long>", "java.util.Set"}, set(lng)); @@ -358,8 +358,8 @@ public class ObjectTypeTests extends Gen public void testInteger() throws GeneralException { simpleTypeConvertTestSingleMulti("Integer->String", Integer.valueOf("1234567"), new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567"); simpleTypeConvertTestSingleMulti("Integer->BigDecimal", intg, new String[] {"BigDecimal", "java.math.BigDecimal"}, new BigDecimal("781")); - simpleTypeConvertTestSingleMulti("Integer->Double", intg, new String[] {"Double", "java.lang.Double"}, new Double("781")); - simpleTypeConvertTestSingleMulti("Integer->Float", intg, new String[] {"Float", "java.lang.Float"}, new Float("781")); + simpleTypeConvertTestSingleMulti("Integer->Double", intg, new String[] { "Double", "java.lang.Double" }, Double.valueOf("781")); + simpleTypeConvertTestSingleMulti("Integer->Float", intg, new String[] { "Float", "java.lang.Float" }, Float.valueOf("781")); simpleTypeConvertTestSingleMulti("Integer->Long", intg, new String[] {"Long", "java.lang.Long"}, lng); simpleTypeConvertTestSingleMulti("Integer->Integer", intg, new String[] {"Integer", "java.lang.Integer"}, Integer.valueOf("781")); simpleTypeConvertTestSingleMulti("Integer->List", intg, new String[] {"List", "List<java.lang.Integer>", "java.util.List"}, list(intg)); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java?rev=1817568&r1=1817567&r2=1817568&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java Fri Dec 8 21:05:00 2017 @@ -58,7 +58,6 @@ public class ReferenceCleanerTests exten assertSame("still-soft", obj, soft.get()); assertSame("still-weak", obj, weak.get()); assertNull("no event", queue.poll(100, TimeUnit.MILLISECONDS)); - obj = null; useAllMemory(); foundEvents.add(queue.poll(100, TimeUnit.MILLISECONDS)); foundEvents.add(queue.poll(100, TimeUnit.MILLISECONDS)); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java?rev=1817568&r1=1817567&r2=1817568&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java Fri Dec 8 21:05:00 2017 @@ -53,7 +53,7 @@ public class StringUtilTests extends Gen public void testInternString() { assertSame("intern-constant", StringUtil.internString("foo"), StringUtil.internString("foo")); - assertSame("intern-new", StringUtil.internString("foo"), StringUtil.internString(new String("foo"))); + assertSame("intern-new", StringUtil.internString("foo"), StringUtil.internString("foo")); assertSame("intern-char", StringUtil.internString("foo"), StringUtil.internString(new String(new char[] {'f', 'o', 'o'}))); assertSame("intern-null", StringUtil.internString(null), StringUtil.internString(null)); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilPropertiesTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilPropertiesTests.java?rev=1817568&r1=1817567&r2=1817568&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilPropertiesTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/UtilPropertiesTests.java Fri Dec 8 21:05:00 2017 @@ -30,8 +30,8 @@ import org.apache.ofbiz.base.util.UtilPr public class UtilPropertiesTests extends GenericTestCaseBase { - private final String country = "AU"; - private final String language = "en"; + private static final String country = "AU"; + private static final String language = "en"; private final Locale locale = new Locale(language, country); public UtilPropertiesTests(String name) { |
Free forum by Nabble | Edit this page |