Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/285#discussion_r77546852
  
    --- Diff: core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java ---
    @@ -407,14 +410,26 @@ private HttpToolResponse 
createHttpToolRespose(HttpResponse response) throws IOE
             Map<String,? extends List<String>> headers = (Map<String, 
List<String>>) (Map<?, ?>) response.headers().asMap();
     
             byte[] content = null;
    -        if (response.getContentLength() > 0) {
    -            content = ByteStreams.toByteArray(response.getContent());
    +        final long durationMillisOfFirstResponse;
    +        final long durationMillisOfFullContent;
    +        final long startTime = System.currentTimeMillis();
    +
    +        ByteArrayOutputStream out = new ByteArrayOutputStream();
    +        durationMillisOfFirstResponse = 
Duration.sinceUtc(startTime).toMilliseconds();
    +        try {
    +            ByteStreams.copy(response.getContent(), out);
    +            content = out.toByteArray();
    +        } catch (IOException e) {
    +            throw Throwables.propagate(e);
    --- End diff --
    
    In Brooklyn the recommended is `Exceptions.propagate`, but this works as 
well in this case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to