Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4134

GZIPOutInterceptor compiles Patterns constantly; they should be compiled once and reused

    XMLWordPrintableJSON

Details

    • Novice

    Description

      GZIPOutInterceptor (lines 193 to 195) use two regular expressions to search for a pattern in a string. They compile the regex on every call, and on every pass through a loop:

      Pattern zeroQ = Pattern.compile(";\\s*q=0(?:
      .0+)?$");
      for (String headerLine : acceptEncodingHeader) {
      String[] encodings = headerLine.trim().split("[,\\s],
      s
      ");

      Compiling patterns is not cheap; please move these patterns (including the String.split() pattern) into the constructor or a static member so we don't keep recompiling the pattern.

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            mattbishop Matt Bishop
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: