diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java index 6f51e1c66..c404a026d 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java @@ -2585,16 +2585,16 @@ public abstract class ToStringStyle implements Serializable { return; } - final String try_value_str = value.toString(); - if (try_value_str.startsWith(getContentStart()) && try_value_str.endsWith(getContentEnd()) - || try_value_str.startsWith(getArrayStart()) && try_value_str.startsWith(getArrayEnd()) + final String valueAsString = value.toString(); + if (valueAsString.startsWith(getContentStart()) && valueAsString.endsWith(getContentEnd()) + || valueAsString.startsWith(getArrayStart()) && valueAsString.startsWith(getArrayEnd()) ) { buffer.append(value); return; } - appendDetail(buffer, fieldName, try_value_str); + appendDetail(buffer, fieldName, valueAsString); } /** diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java index 4d23d5332..e5821d570 100644 --- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java @@ -111,7 +111,7 @@ public class JsonToStringStyleTest { public void testDate() { final Date now = new Date(); - final Date after_now = new Date(System.currentTimeMillis() + 1); + final Date afterNow = new Date(System.currentTimeMillis() + 1); try { new ToStringBuilder(base).append(now).toString(); @@ -121,7 +121,7 @@ public class JsonToStringStyleTest { assertEquals("{\"now\":\"" + now.toString() +"\"}", new ToStringBuilder(base).append("now", now) .toString()); - assertEquals("{\"now\":\"" + now.toString() +"\",\"after\":\"" + after_now.toString() + "\"}", new ToStringBuilder(base).append("now", now).append("after", after_now) + assertEquals("{\"now\":\"" + now.toString() +"\",\"after\":\"" + afterNow.toString() + "\"}", new ToStringBuilder(base).append("now", now).append("after", afterNow) .toString()); }