EntityUtils.toString() turns missing content into ""
----------------------------------------------------

                 Key: HTTPCORE-233
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-233
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
    Affects Versions: 4.0.1
         Environment: Ubuntu 10.04 x64 java 6u21
            Reporter: Steve Loughran


I understand that some people may view this as expected behaviour, but I'm 
trying to track down why some of my tests are failing with a message body of "" 
rather than some JSON, and it looks to me a bit like {{EntityUtils}} is at 
fault for hiding the real problem.

Looking at line 138 of {{EntityUtils}} , the code goes
{code}
        InputStream instream = entity.getContent();
        if (instream == null) {
            return "";
        }
{code}
that is, null content is turned into an empty string. I'd be happier if null 
content got returned as null, then I'd be able to distinguish problems. As it 
is, I'm going to have to copy the method and tweak it. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to