[ 
https://issues.apache.org/jira/browse/LANG-1337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040318#comment-16040318
 ] 

ASF GitHub Bot commented on LANG-1337:
--------------------------------------

Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/269#discussion_r120546260
  
    --- Diff: 
src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java ---
    @@ -316,7 +316,7 @@ public void testReflectionHierarchyArrayList() {
             // 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<Object> list = new ArrayList<>();
    +        final List<Object> list = new ArrayList<>(10);
    --- End diff --
    
    >If the test fails when the initial size arg is omitted, does that not also 
affect the behaviour of the method being tested?
    
    Not really. The test simply checks the string built for an arraylist 
through reflection. The issue was caused for believing that the lazy 
initialization (as @andyklimczak) would work in the same independent of the JVM.
    
    What the test is verifying is correct, the current approach could be 
improved to make the test less flaky.


> Fix test failures in IBM JDK 8 for ToStringBuilderTest
> ------------------------------------------------------
>
>                 Key: LANG-1337
>                 URL: https://issues.apache.org/jira/browse/LANG-1337
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.5
>         Environment: java version "1.8.0"
> Java(TM) SE Runtime Environment (build pxa6480sr4fp6-20170518_02(SR4 FP6))
> IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 
> 20170516_348050 (JIT enabled, AOT enabled)
> J9VM - R28_20170516_1905_B348050
> JIT  - tr.r14.java_20170516_348050
> GC   - R28_20170516_1905_B348050_CMPRSS
> J9CL - 20170516_348050)
> JCL - 20170516_01 based on Oracle jdk8u131-b11
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 
> 2015-11-11T05:41:47+13:00)
> Maven home: /opt/maven
> Java version: 1.8.0, vendor: IBM Corporation
> Java home: /home/kinow/Development/java/ibm-java-x86_64-80/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.4.0-78-generic", arch: "amd64", family: "unix"
> git sha 551101299da7f75ea5478db1a6bc194963e0ac34
>            Reporter: Bruno P. Kinoshita
>            Assignee: Bruno P. Kinoshita
>            Priority: Minor
>              Labels: ibm, ibm-jdk, test
>             Fix For: 3.6
>
>
> From the 3.6 thread RC2. We had issues in the release. Two tests failed. One 
> of these tests happened on IBM JDK 8, and was related to time zones. Gary 
> Gregory quickly pointed that the very latest IBM JDK 8 released did not had 
> this issue.
> Indeed, I grabbed a JDK 8 from IBM and had this issue, and then after looking 
> for the latest version, I had only one test failing. This test in question 
> was ToStringBuilderTest#testReflectionHierarchyArrayList.
> Debugging the test in Eclipse, with the JDK pointing to IBM JDK 8 (and taking 
> care to not let the Eclipse maven integration change it), there is a part of 
> the code that receives an ArrayList object to create a String with reflection.
> In Oracle JDK 7, the object contains the default 10 empty positions, and thus 
> the generated String is.
> {noformat}
> java.util.ArrayList@761a4a3d[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]
> {noformat}
> But with IBM JDK 8, the ArrayList is empty, nada, and then I get the 
> following in the Eclipse debugger.
> {noformat}
> java.util.ArrayList@761a4a3d[elementData={},size=0,modCount=0]
> {noformat}
> The test is - as commented in LANG-727 - a bit flaky. However, the expected 
> string assumes ArrayList will have an initial 10 null values. So the pull 
> request in this issue simply creates an ArrayList with 10 initial capacity 
> :-) a naïve approach, but that I believe fixes this test.
> The changes in the pull request linked to this issue have all tests passing 
> with the following set-ups:
> {noformat}
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 
> 2015-11-11T05:41:47+13:00)
> Maven home: /opt/maven
> Java version: 1.7.0_80, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/java-7-oracle/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.4.0-78-generic", arch: "amd64", family: "unix"
> ---
> java version "1.7.0_80"
> Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
> Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 
> 2015-11-11T05:41:47+13:00)
> Maven home: /opt/maven
> Java version: 1.8.0_131, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/java-8-oracle/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.4.0-78-generic", arch: "amd64", family: "unix"
> ---
> java version "1.8.0_131"
> Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
> Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 
> 2015-11-11T05:41:47+13:00)
> Maven home: /opt/maven
> Java version: 1.8.0, vendor: IBM Corporation
> Java home: /home/kinow/Development/java/ibm-java-x86_64-80/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.4.0-78-generic", arch: "amd64", family: "unix"
> ---
> java version "1.8.0"
> Java(TM) SE Runtime Environment (build pxa6480sr4fp6-20170518_02(SR4 FP6))
> IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 
> 20170516_348050 (JIT enabled, AOT enabled)
> J9VM - R28_20170516_1905_B348050
> JIT  - tr.r14.java_20170516_348050
> GC   - R28_20170516_1905_B348050_CMPRSS
> J9CL - 20170516_348050)
> JCL - 20170516_01 based on Oracle jdk8u131-b11
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to