[
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=450440&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-450440
]
ASF GitHub Bot logged work on LANG-1542:
----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Jun/20 13:29
Start Date: 24/Jun/20 13:29
Worklog Time Spent: 10m
Work Description: garydgregory edited a comment on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-648819474
-1: See below, I will provide an alternate implementation.
- The new method makes a copy of the collection as a new array, this can be
done without the extra allocation.
- The arguments to assertEquals() are backward: The order is (expected,
actual). If you do not follow the proper argument order, the failure messages
are REALLY confusing ;-)
- The new tests do not cover edge cases:
-- null array of enums
-- empty array of enums
-- null list of enums
-- empty list of enums
----------------------------------------------------------------
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: 450440)
Time Spent: 3.5h (was: 3h 20m)
> ToStringBuilder.reflectionToString - Wrong JSON format when object has a
> List/Array of Enum
> -------------------------------------------------------------------------------------------
>
> Key: LANG-1542
> URL: https://issues.apache.org/jira/browse/LANG-1542
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.10
> Environment: Open JDK 1.8
> Reporter: Trần Ngọc Khoa
> Priority: Major
> Fix For: 3.11
>
> Time Spent: 3.5h
> Remaining Estimate: 0h
>
> I'm trying to log an object to console with JSON style using
> {{ToStringBuilder.reflectionToString}} from {{commons-lang3:3.10}} but it
> seems generated a wrong JSON format.
> Problem happening when I have a list of enums in my field list.
>
> {code:java}
> This is the class:
> public class Person {
> private long id;
> private String name;
> private List<MyEnum> listEnums;
> //getter and setter
> public String toString(){
> return ToStringBuilder.reflectionToString(this,
> ToStringStyle.JSON_STYLE);
> }
> }
> {code}
>
> And {{MyEnum}}:
> {code:java}
> public enum MyEnum {
> FOOD,
> SPORT,
> BOOK,
> MUSIC
> }{code}
> When I call {{toString()}} of Person object. It shows like this
> {code:java}
> {
> "id": 1,
> "name": "Karl",
> "listEnums": [FRIDAY, MONDAY, TUESDAY]
> }{code}
>
> What I expected is:
> {code:java}
> {
> "id": 1,
> "name": "Karl",
> "listEnums": ["FRIDAY", "MONDAY", "TUESDAY"]
> }{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)