Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1929

Do not unnecessarily allocate an array

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 7.0.2
    • None
    • None
    • Patch

    Description

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

        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() + "");
              }
          }
      

      Pull request in github is provided

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              SvetlinZarev Svetlin Zarev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: