[ https://issues.apache.org/jira/browse/TOMEE-1929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15487265#comment-15487265 ]
ASF GitHub Bot commented on TOMEE-1929: --------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/tomee/pull/37 > 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 > Fix For: 7.0.2 > > > 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)