[ https://issues.apache.org/jira/browse/TOMEE-1929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15487208#comment-15487208 ]
ASF GitHub Bot commented on TOMEE-1929: --------------------------------------- GitHub user SvetlinZarev opened a pull request: https://github.com/apache/tomee/pull/37 Do not unnecessarily allocate an array Bug: TOMEE-1929 You can merge this pull request into a Git repository by running: $ git pull https://github.com/SvetlinZarev/tomee array-fix Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tomee/pull/37.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #37 ---- commit ca7f1551c00fdaf80e5ac399b813fb1725b5f9c4 Author: Svetlin Zarev <svetlin.za...@sap.com> Date: 2016-09-13T13:29:10Z Do not unnecessarily allocate an array ---- > 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)