You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Joerg Schaible (JIRA)" <ji...@apache.org> on 2011/07/15 08:58:59 UTC

[jira] [Created] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
-------------------------------------------------------------------------

                 Key: LANG-727
                 URL: https://issues.apache.org/jira/browse/LANG-727
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.builder.*
    Affects Versions: 3.0
            Reporter: Joerg Schaible
            Priority: Trivial


The unit test fails when running with IBM JDK 6:
{noformat}
Failed tests: 
  testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
{noformat}
Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13078436#comment-13078436 ] 

Joerg Schaible commented on LANG-727:
-------------------------------------

Actually I am not sure what the test shall demonstrate. Is it a special type construction that is arbitrarily present in ArrayList or does it demonstrate that it can also handle an ArrayList. If it is the latter then we have to check for a different String representation with IBM JDK 6 runtime, because it exposes implementation details of the type.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072564#comment-13072564 ] 

Henri Yandell commented on LANG-727:
------------------------------------

It's a bad assumption :)

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13078587#comment-13078587 ] 

Henri Yandell commented on LANG-727:
------------------------------------

svn ci -m "Rolling back r1153037 and r1153038 - the changes didn't help"
Sending        src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
Transmitting file data .
Committed revision 1153343.


> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-727:
-------------------------------

    Fix Version/s: 3.0.1

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-727:
-------------------------------

    Fix Version/s:     (was: 3.0.1)
                   3.0.2

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.2
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071764#comment-13071764 ] 

Matt Benson commented on LANG-727:
----------------------------------

Alternatively, when we know that we're making assumptions about a class's inner implementation, we could upgrade the test to JUnit 4 and add an assumption at the beginning of the test wrt the particular JVM vendor.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13079977#comment-13079977 ] 

Matt Benson commented on LANG-727:
----------------------------------

I presume the property we'd need to check would be *java.vendor* as opposed to *java.vm.vendor*, but I'd be glad for a second opinion.  Note that the test also passes on an Apple JDK, so I'd prefer we disable it only on IBM for now until/unless we encounter another classlib that gives us the same problem.

Joerg, can you give us the java.vendor values for whichever JDKs fail?  Or, for example, does the test pass on an earlier IBM JDK?  If so, can you give me whatever property values I need to distinguish the environment in which we expect a failure?

Thanks!

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.2
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080068#comment-13080068 ] 

Joerg Schaible commented on LANG-727:
-------------------------------------

java.vendor is the same. Actually we don't have to take this issue too serious. The implementation can handle the ArrayList also for IBM JDK 6. The internals are different but it provides proper information. It's the test that is flaky with its assumptions. Therefore I'd add a comment to state the fact that the result depends on the implementation details of ArrayList that is vendor/version specific. IBM JDK 6 is known for the difference and is currently the only known one with different implementation.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.2
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joerg Schaible updated LANG-727:
--------------------------------

    Fix Version/s:     (was: 3.0.2)
                   3.0.1
         Assignee: Joerg Schaible

Committed revision 1154530.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Assignee: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Reopened] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joerg Schaible reopened LANG-727:
---------------------------------


Sorry to say, but it will still fail. See the error message. On IBM JDK there is no "elementData" member at all.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072591#comment-13072591 ] 

Matt Benson commented on LANG-727:
----------------------------------

right, so the test will be skipped whenever the assumption proves to have been incorrect...

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080001#comment-13080001 ] 

Matt Benson commented on LANG-727:
----------------------------------

We _could_ do it that way, though it would at least make the test less concise.  So is it your opinion that the java.vm.vendor is the important thing here, rather than the java.vendor?  I would have thought that *java* would signify the class library in use while *vm* would signify only that (the VM).  WDYT?  What is the value of java.vendor?

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.2
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joerg Schaible resolved LANG-727.
---------------------------------

    Resolution: Fixed

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Assignee: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13078443#comment-13078443 ] 

Matt Benson commented on LANG-727:
----------------------------------

I maintain that this test just verifies expectations of the code when running under a certain set of assumptions, including "the ArrayList implementation in use has an elementData member."  If we know that that means the Sun JDK, we should just turn the test off under other circumstances.  It's not like we don't have the vendor info readily available; this _is_ Commons Lang, after all.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13078586#comment-13078586 ] 

Henri Yandell commented on LANG-727:
------------------------------------

1) Doh :) I'll revert the commit.
2) Happy with your Sun JDK only approach Matt.
3) I assume the test is to show it can handle ArrayList too.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell resolved LANG-727.
--------------------------------

    Resolution: Fixed

I've applied the code change I proposed.

svn ci -m "Rearranging the testReflectionHierarchyArrayList test per LANG-727; shouldn't make assumptions about ArrayList now"
Sending        src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
Transmitting file data .
Committed revision 1153037.


> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13079801#comment-13079801 ] 

Joerg Schaible commented on LANG-727:
-------------------------------------

If you postpone this issue, don't forget to drop it again from changes.xml also :)

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.2
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13079997#comment-13079997 ] 

Joerg Schaible commented on LANG-727:
-------------------------------------

java.specification.version: 1.6
java.vm.vendor: IBM Corporation

IBM JDK 1.5 works. Maybe we can compare the strings and if they're not equal, we look for the JDK. For this one we can print a known issue to sysout, for all others we should fail.

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.2
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (LANG-727) ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071496#comment-13071496 ] 

Henri Yandell commented on LANG-727:
------------------------------------

Looking at the code:

{code:java}
        assertEquals(baseStr + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]", ToStringBuilder.reflectionToString(base, null, true));
        assertEquals(baseStr + "[size=0]", ToStringBuilder.reflectionToString(base, null, false));
{code}

I think the 2nd test should pass as there's only one item. So just the first one to fix. I think we can use StringUtils.contains, ie:

{code:java}
        String result = ToStringBuilder.reflectionToString(base, null, true);
        assertTrue( StringUtils.startsWith(result, baseStr + "[") );
        assertTrue( StringUtils.contains(result, "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>}" ) );
        assertTrue( StringUtils.contains(result, "size=0") );
        assertTrue( StringUtils.contains(result, "modCount=0") );
        assertTrue( StringUtils.endsWith(result, "]") );
        assertEquals(baseStr + "[size=0]", ToStringBuilder.reflectionToString(base, null, false));
{code}

Is that something you could easily test in JDK 6 and commit?

I also suspect that we should hard code the elementData size by doing ArrayList(10).

> ToStringBuilderTest.testReflectionHierarchyArrayList fails with IBM JDK 6
> -------------------------------------------------------------------------
>
>                 Key: LANG-727
>                 URL: https://issues.apache.org/jira/browse/LANG-727
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.0
>            Reporter: Joerg Schaible
>            Priority: Trivial
>             Fix For: 3.0.1
>
>
> The unit test fails when running with IBM JDK 6:
> {noformat}
> Failed tests: 
>   testReflectionHierarchyArrayList(org.apache.commons.lang3.builder.ToStringBuilderTest): null 
> expected:<....ArrayList@115b115b[[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>},size=0],modCount=0]>
> but was:<....ArrayList@115b115b[[firstIndex=0,lastIndex=0,array={<null>,<null>,<null>,<null>,<null>,<null>,<null>,null>,null>,null>}],modCount=0]>
> {noformat}
> Actually the test is wrong, because it makes wrong assumptions about the implementation of ArrayList in the runtime.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira