[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439545=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439545
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 14:05
Start Date: 01/Jun/20 14:05
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-629603951


   
   [![Coverage 
Status](https://coveralls.io/builds/31160874/badge)](https://coveralls.io/builds/31160874)
   
   Coverage increased (+0.001%) to 95.042% when pulling 
**540dcf0ea0b52bbf62bfff1ab0474afff0494901 on TranNgocKhoa:master** into 
**115a6c64bc6dad12edaf3c5deaac7bffa0fa3b86 on apache:master**.
   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439545)
Time Spent: 3h  (was: 2h 50m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 3h
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439542=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439542
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 13:56
Start Date: 01/Jun/20 13:56
Worklog Time Spent: 10m 
  Work Description: TranNgocKhoa commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r433248583



##
File path: src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java
##
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.lang3.builder;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
 import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;

Review comment:
   @XenoAmess fixed, thank you!





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439542)
Time Spent: 2h 50m  (was: 2h 40m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 2h 50m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439497=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439497
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 12:12
Start Date: 01/Jun/20 12:12
Worklog Time Spent: 10m 
  Work Description: XenoAmess removed a comment on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-636821075


   Hi.
   I don't think the changes in ToStringStyleTest.java is necessary...



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439497)
Time Spent: 2h 40m  (was: 2.5h)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 2h 40m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439496=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439496
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 12:12
Start Date: 01/Jun/20 12:12
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r433198201



##
File path: src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java
##
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.lang3.builder;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
 import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;

Review comment:
   Hi.
   I don't think the changes in ToStringStyleTest.java is necessary...





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439496)
Time Spent: 2.5h  (was: 2h 20m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 2.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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-06-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439495=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439495
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 12:08
Start Date: 01/Jun/20 12:08
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-636821075


   Hi.
   I don't think the changes in ToStringStyleTest.java is necessary...



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439495)
Time Spent: 2h 20m  (was: 2h 10m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 2h 20m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439345=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439345
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 05:31
Start Date: 01/Jun/20 05:31
Worklog Time Spent: 10m 
  Work Description: kinow commented on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-636621642


   BTW, @TranNgocKhoa if you could rebase it, the build should pass. There were 
checkstyle issues on master until recently.



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439345)
Time Spent: 2h 10m  (was: 2h)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 2h 10m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439344=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439344
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 01/Jun/20 05:26
Start Date: 01/Jun/20 05:26
Worklog Time Spent: 10m 
  Work Description: kinow commented on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-636620127


   Will leave it to @garydgregory to do the final review as he had requested 
changes before :+1: 



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439344)
Time Spent: 2h  (was: 1h 50m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 2h
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439260=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439260
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 31/May/20 15:52
Start Date: 31/May/20 15:52
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-629603951


   
   [![Coverage 
Status](https://coveralls.io/builds/31144338/badge)](https://coveralls.io/builds/31144338)
   
   Coverage increased (+0.0009%) to 95.092% when pulling 
**852f924c95b39b7f4b745f3b0f4d2872abf5aed5 on TranNgocKhoa:master** into 
**f6923510352fc3fbfad68bc6c5ac5258a34671b7 on apache:master**.
   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439260)
Time Spent: 1h 50m  (was: 1h 40m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 1h 50m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=439187=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439187
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 31/May/20 06:53
Start Date: 31/May/20 06:53
Worklog Time Spent: 10m 
  Work Description: TranNgocKhoa commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r432916255



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   @swarajsaaj, I added test case for it





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 439187)
Time Spent: 1h 40m  (was: 1.5h)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 1h 40m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434088=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434088
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 17:04
Start Date: 16/May/20 17:04
Worklog Time Spent: 10m 
  Work Description: swarajsaaj commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426171315



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   This should fix the case I mentioned earlier. I guess, test cases can 
also be updated for non-enum collections, else seems good.





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434088)
Time Spent: 1.5h  (was: 1h 20m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 1.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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434087=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434087
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 17:03
Start Date: 16/May/20 17:03
Worklog Time Spent: 10m 
  Work Description: swarajsaaj commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426171315



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   This should fix the case I mentioned earlier. Seems good.





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434087)
Time Spent: 1h 20m  (was: 1h 10m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 1h 20m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434073=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434073
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 13:56
Start Date: 16/May/20 13:56
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-629603951


   
   [![Coverage 
Status](https://coveralls.io/builds/30832851/badge)](https://coveralls.io/builds/30832851)
   
   Coverage increased (+0.0009%) to 95.092% when pulling 
**59ab563d411b8e2e909af54527698d02c584f043 on TranNgocKhoa:master** into 
**f6923510352fc3fbfad68bc6c5ac5258a34671b7 on apache:master**.
   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434073)
Time Spent: 1h 10m  (was: 1h)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 1h 10m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434070=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434070
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 13:47
Start Date: 16/May/20 13:47
Worklog Time Spent: 10m 
  Work Description: TranNgocKhoa commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426155133



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   @garydgregory @swarajsaaj I added some code following your comments. 
Please take a look. Thank you!





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434070)
Time Spent: 1h  (was: 50m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 1h
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434069=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434069
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 12:43
Start Date: 16/May/20 12:43
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426150483



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   We should avoid using streams here IMO, it will likely make performance 
worse in what can already be slow when reflection is involved. 





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434069)
Time Spent: 50m  (was: 40m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 50m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434053=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434053
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 11:08
Start Date: 16/May/20 11:08
Worklog Time Spent: 10m 
  Work Description: swarajsaaj commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426143710



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   Hello, this will restrict only enums to be appended from a collection, a 
list of other types (e.g. Collection of Integers or Strings) will be ignored. 
This filter should be removed to allow all types of collections (or we should 
allow buffer.append(col1) at last line of method to run for other types, either 
way)





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434053)
Time Spent: 40m  (was: 0.5h)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 40m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434050=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434050
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 11:05
Start Date: 16/May/20 11:05
Worklog Time Spent: 10m 
  Work Description: swarajsaaj commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426143710



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   This will restrict only enums to be appended in a collection, a list of 
other types (e.g. Collection or Collection) will be ignored. 
This filter should be removed.





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434050)
Time Spent: 20m  (was: 10m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 20m
>  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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434051=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434051
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 11:05
Start Date: 16/May/20 11:05
Worklog Time Spent: 10m 
  Work Description: swarajsaaj commented on a change in pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#discussion_r426143710



##
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##
@@ -635,6 +635,14 @@ protected void appendDetail(final StringBuffer buffer, 
final String fieldName, f
  *  {@code toString}, not {@code null}
  */
 protected void appendDetail(final StringBuffer buffer, final String 
fieldName, final Collection coll) {
+if (coll != null && !coll.isEmpty()) {
+coll.stream().findFirst()
+.map(Object::getClass)
+.filter(Class::isEnum)

Review comment:
   This will restrict only enums to be appended in a collection, a list of 
other types (e.g. Collection of Integers or Strings) will be ignored. This 
filter should be removed.





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434051)
Time Spent: 0.5h  (was: 20m)

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 0.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 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)


[jira] [Work logged] (LANG-1542) ToStringBuilder.reflectionToString - Wrong JSON format when object has a List of Enum

2020-05-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1542?focusedWorklogId=434034=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434034
 ]

ASF GitHub Bot logged work on LANG-1542:


Author: ASF GitHub Bot
Created on: 16/May/20 07:45
Start Date: 16/May/20 07:45
Worklog Time Spent: 10m 
  Work Description: coveralls commented on pull request #530:
URL: https://github.com/apache/commons-lang/pull/530#issuecomment-629603951


   
   [![Coverage 
Status](https://coveralls.io/builds/30829712/badge)](https://coveralls.io/builds/30829712)
   
   Coverage increased (+0.002%) to 95.093% when pulling 
**4391efd0b40a2455c84e8950d70b3668b7992bf6 on TranNgocKhoa:master** into 
**f6923510352fc3fbfad68bc6c5ac5258a34671b7 on apache:master**.
   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 434034)
Remaining Estimate: 0h
Time Spent: 10m

> ToStringBuilder.reflectionToString - Wrong JSON format when object has a List 
> 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
>  Time Spent: 10m
>  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 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)