Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1337

Fix test failures in IBM JDK 8 for ToStringBuilderTest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.5
    • 3.6
    • lang.*
    • Patch

    Description

      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.

      java.util.ArrayList@761a4a3d[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]
      

      But with IBM JDK 8, the ArrayList is empty, nada, and then I get the following in the Eclipse debugger.

      java.util.ArrayList@761a4a3d[elementData={},size=0,modCount=0]
      

      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:

      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
      

      Attachments

        Issue Links

          Activity

            People

              kinow Bruno P. Kinoshita
              kinow Bruno P. Kinoshita
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: