You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Svetlin Zarev (JIRA)" <ji...@apache.org> on 2016/09/13 13:33:20 UTC

[jira] [Created] (TOMEE-1929) Do not unnecessarily allocate an array

Svetlin Zarev created TOMEE-1929:
------------------------------------

             Summary: Do not unnecessarily allocate an array
                 Key: TOMEE-1929
                 URL: https://issues.apache.org/jira/browse/TOMEE-1929
             Project: TomEE
          Issue Type: Improvement
            Reporter: Svetlin Zarev
            Priority: Trivial


There is no need to allocate an array just get it's length. 

{code}
  private void setContentLengthHeader() {
        if (content == null) {
            writer.flush();
            writer.close();
            final int length = sosi.getOutputStream().toByteArray().length;
            setHeader("Content-Length", length + "");
        } else {
            setHeader("Content-Length", content.getContentLength() + "");
        }
    }
{code}

Pull request in github is provided



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)