You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jim Gan <jg...@oath.com.INVALID> on 2018/05/09 00:10:48 UTC

commons-lang class JsonToStringStyle does not escape double quote in a string value

If string value contains double quote,   JsonToStringStyle generates
invalid json string.

Here is the detail :

The code at line 2609  needs to escape the double quote before appending it
to the buffer.


https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java

line 2608 and line 2609

       private void appendValueAsString(final StringBuffer buffer,
final String value) {
            buffer.append('"').append(value).append('"');
        }


Jim

Re: commons-lang class JsonToStringStyle does not escape double quote in a string value

Posted by sebb <se...@gmail.com>.
Ticket exists:

https://issues.apache.org/jira/browse/LANG-1395

No patch as yet.

On 9 May 2018 at 13:46, Martin Gainty <mg...@hotmail.com> wrote:
> can you submit a JIRA ticket with patch?
>
>
> Martin
>
> ________________________________
> From: Jim Gan <jg...@oath.com.INVALID>
> Sent: Tuesday, May 8, 2018 8:10 PM
> To: user@commons.apache.org
> Subject: commons-lang class JsonToStringStyle does not escape double quote in a string value
>
> If string value contains double quote,   JsonToStringStyle generates
> invalid json string.
>
> Here is the detail :
>
> The code at line 2609  needs to escape the double quote before appending it
> to the buffer.
>
>
> https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
> [https://avatars3.githubusercontent.com/u/47359?s=400&v=4]<https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java>
>
> apache/commons-lang<https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java>
> github.com
> commons-lang - Mirror of Apache Commons Lang
>
>
>
>
> line 2608 and line 2609
>
>        private void appendValueAsString(final StringBuffer buffer,
> final String value) {
>             buffer.append('"').append(value).append('"');
>         }
>
>
> Jim

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: commons-lang class JsonToStringStyle does not escape double quote in a string value

Posted by Martin Gainty <mg...@hotmail.com>.
can you submit a JIRA ticket with patch?


Martin

________________________________
From: Jim Gan <jg...@oath.com.INVALID>
Sent: Tuesday, May 8, 2018 8:10 PM
To: user@commons.apache.org
Subject: commons-lang class JsonToStringStyle does not escape double quote in a string value

If string value contains double quote,   JsonToStringStyle generates
invalid json string.

Here is the detail :

The code at line 2609  needs to escape the double quote before appending it
to the buffer.


https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
[https://avatars3.githubusercontent.com/u/47359?s=400&v=4]<https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java>

apache/commons-lang<https://github.com/apache/commons-lang/blob/c614fbcc79615f93d2c60a153db6e82d7474c425/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java>
github.com
commons-lang - Mirror of Apache Commons Lang




line 2608 and line 2609

       private void appendValueAsString(final StringBuffer buffer,
final String value) {
            buffer.append('"').append(value).append('"');
        }


Jim