commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita (JIRA)" <>
Subject [jira] [Commented] (LANG-1374) Parsing Json Array failed
Date Thu, 04 Jan 2018 09:18:00 GMT


Bruno P. Kinoshita commented on LANG-1374:

Nice catch! Thanks for reporting the issue.

Fixed with a small test that will force the code to go through that line. Probably coverage
will increase a tiny bit.

However, that test is not really important. The output generated with or without the fix is
the same, from what I could tell. When that check returns - incorrectly - false, then result
of toString() is appended anyway.

But for the sake of correctness, we should fix that method and allow it to follow the correct
execution logic :-)

Thanks again for spotting it and for providing the fix. Feel free to submit a pull request
next time if you'd like your code to be included with the project. Added credits in the changes.xml,
so it should appear in the website after the next release.


> Parsing Json Array failed
> -------------------------
>                 Key: LANG-1374
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.7
>            Reporter: Jaswanth Bala
>            Assignee: Bruno P. Kinoshita
>            Priority: Trivial
>             Fix For: 3.8
>   Original Estimate: 1h
>  Remaining Estimate: 1h
> In ToStringStyle class, which checking if a string is a valid Json array, the boolean
check was wrong.
> original:
> {code:java}
>         private boolean isJsonArray(final String valueAsString) {
>             return valueAsString.startsWith(getArrayStart())
>                     && valueAsString.startsWith(getArrayEnd());
>         }
> {code}
> The second expression should be valueAsString.endsWith(getArrayEnd())

This message was sent by Atlassian JIRA

View raw message