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

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

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

Romain Manni-Bucau resolved TOMEE-1929.
---------------------------------------
    Resolution: Fixed

> 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)