You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2015/12/11 22:03:08 UTC

svn commit: r1719560 - /jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java

Author: fschumacher
Date: Fri Dec 11 21:03:08 2015
New Revision: 1719560

URL: http://svn.apache.org/viewvc?rev=1719560&view=rev
Log:
Remove TODO by extracting local Pattern to statc class private instance. Pattern is thread safe.

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java?rev=1719560&r1=1719559&r2=1719560&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java Fri Dec 11 21:03:08 2015
@@ -98,6 +98,8 @@ public class ReportGenerator {
     public static final String STATISTICS_SUMMARY_CONSUMER_NAME = "statisticsSummary";
     public static final String START_INTERVAL_CONTROLLER_FILTER_CONSUMER_NAME = "startIntervalControlerFilter";
 
+    private static final Pattern POTENTIAL_CAMEL_CASE_PATTERN = Pattern.compile("_(.)");
+
     private final File testFile;
     private final ReportGeneratorConfiguration configuration;
 
@@ -113,6 +115,7 @@ public class ReportGenerator {
      *            the test results file
      * @param resultCollector
      *            Can be null, used if generation occurs at end of test
+     * @throws ConfigurationException when loading configuration from file fails
      */
     public ReportGenerator(String resultsFile, ResultCollector resultCollector)
             throws ConfigurationException {
@@ -160,9 +163,7 @@ public class ReportGenerator {
      * @return the name of the property setter
      */
     private static String getSetterName(String propertyKey) {
-        // TODO use jmeter regex cache
-        Pattern pattern = Pattern.compile("_(.)");
-        Matcher matcher = pattern.matcher(propertyKey);
+        Matcher matcher = POTENTIAL_CAMEL_CASE_PATTERN.matcher(propertyKey);
         StringBuffer buffer = new StringBuffer();
         while (matcher.find()) {
             matcher.appendReplacement(buffer, matcher.group(1).toUpperCase());