[
https://issues.apache.org/jira/browse/LANG-1600?focusedWorklogId=474020&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-474020
]
ASF GitHub Bot logged work on LANG-1600:
----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Aug/20 19:39
Start Date: 24/Aug/20 19:39
Worklog Time Spent: 10m
Work Description: amphied opened a new pull request #610:
URL: https://github.com/apache/commons-lang/pull/610
Restore non-json-style handling of appendDetail() for Collection
* addresses issue introduced in LANG-1542 with commit 1dddec8
* add test cases for non-empty collections, maps, and arrays
* break out those test cases into separate methods for legibility
CLA: n/a, covered by clause 5 of the Apache License
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 474020)
Remaining Estimate: 0h
Time Spent: 10m
> ToStringBuilder behavior for collections changed with 3.11
> ----------------------------------------------------------
>
> Key: LANG-1600
> URL: https://issues.apache.org/jira/browse/LANG-1600
> Project: Commons Lang
> Issue Type: Bug
> Affects Versions: 3.11
> Environment: {code:none}
> java -version
> openjdk version "1.8.0_242"
> OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
> OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)
> {code}
> commons-lang3-3.10.jar via maven central
> commons-lang3-3.11.jar via maven central
> Reporter: Michael F
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The fix in LANG-1542 (git commit
> [1dddec8|https://github.com/apache/commons-lang/commit/1dddec8ba867bc31233ba194f0753ea35818cbfd])
> had side effects and did not just affect json styles, but {{DEFAULT_STYLE}},
> {{SHORT_PREFIX_STYLE}}, and possibly others as well.
> Also, collections are now treated differently when empty:
> Square brackets for empty list vs. curly brackets for non-empty lists.
> h3. Test case
> {code:java}
> new ToStringBuilder(new Object(), ToStringStyle.SHORT_PREFIX_STYLE)
> .append("foo0", Collections.emptyList())
> .append("foo1", Collections.singleton("1"))
> .append("foo2", Arrays.asList("1", "2"))
> .build();
> {code}
> h3. {{SHORT_PREFIX_STYLE}}
> Result for version 3.11:
> {code:none}
> Object[foo0=[],foo1={1},foo2={1,2}]
> {code}
> Expected (also as-is for 3.10)
> {code:none}
> Object[foo0=[],foo1=[1],foo2=[1, 2]]
> {code}
> h3. {{DEFAULT_STYLE}}
> Result for version 3.11
> {code:none}
> java.lang.Object@7960847b[foo0=[],foo1={1},foo2={1,2}]
> {code}
> Expected (also as-is for 3.10)
> {code:none}
> java.lang.Object@7960847b[foo0=[],foo1=[1],foo2=[1, 2]]
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)