tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TOMEE-1929) Do not unnecessarily allocate an array
Date Tue, 13 Sep 2016 13:52:22 GMT

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

Mime
View raw message