diff --git a/src/changes/changes.xml b/src/changes/changes.xml index cb2cbf3e0..4496b9b2a 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove. + Fix test failures in IBM JDK 8 for ToStringBuilderTest Add method in StringUtils to determine if string contains both mixed cased characters Deprecate CharEncoding in favour of java.nio.charset.StandardCharsets MultilineRecursiveToStringStyle StackOverflowError when object is an array diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java index 1e805bec7..5ad16d165 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java @@ -36,6 +36,8 @@ import org.junit.Test; */ public class ToStringBuilderTest { + // See LANG-1337 for more. + private static final int ARRAYLIST_INITIAL_CAPACITY = 10; private final Integer base = Integer.valueOf(5); private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); @@ -316,7 +318,8 @@ public class ToStringBuilderTest { // representation different for IBM JDK 1.6.0, LANG-727 assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION)); assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0); - final List list = new ArrayList<>(); + // LANG-1337 without this, the generated string can differ depending on the JVM version/vendor + final List list = new ArrayList<>(ARRAYLIST_INITIAL_CAPACITY); final String baseString = this.toBaseString(list); final String expectedWithTransients = baseString + "[elementData={,,,,,,,,,},size=0,modCount=0]"; final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true);