[ 
https://issues.apache.org/jira/browse/CODEC-229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb resolved CODEC-229.
------------------------
       Resolution: Fixed
    Fix Version/s: 1.11

URL: http://svn.apache.org/viewvc?rev=1788755&view=rev
Log:
CODEC-229 StringUtils.newStringxxx(null) should return null, not NPE

Modified:
    commons/proper/codec/trunk/src/changes/changes.xml
    
commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/StringUtils.java
    
commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/binary/StringUtilsTest.java


> StringUtils.newStringxxx(null) should return null, not NPE
> ----------------------------------------------------------
>
>                 Key: CODEC-229
>                 URL: https://issues.apache.org/jira/browse/CODEC-229
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.10
>            Reporter: Sebb
>             Fix For: 1.11
>
>
> Method calls such as StringUtils.newStringIso8859_1(null) should return null, 
> not NPE.
> It looks like this capability was lost with the fix for CODEC-136, i.e.
> http://svn.apache.org/viewvc?rev=1306366&view=rev
> Several methods were changed from
> {code}
> return StringUtils.newString(bytes, CharEncoding.xxx);
> to
> return new String(bytes, Charsets.xxx);
> {code}
> The new code should have been:
> {code}
> return newString(bytes, Charsets.xxx);
> {code}
> The newString method handles null input.
> There were no tests for null input so the change in behaviour was missed.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to