jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1801984 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
Date Fri, 14 Jul 2017 20:01:17 GMT
Author: pmouawad
Date: Fri Jul 14 20:01:17 2017
New Revision: 1801984

URL: http://svn.apache.org/viewvc?rev=1801984&view=rev
Log:
Little optimisation

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java?rev=1801984&r1=1801983&r2=1801984&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
Fri Jul 14 20:01:17 2017
@@ -630,17 +630,17 @@ public class HTTPJavaImpl extends HTTPAb
     }
 
     private Header[] getHeaders(HeaderManager headerManager) {
-        if (headerManager == null) {
-            return new Header[0];
-        }
-        final List<Header> allHeaders = new ArrayList<>();
-        final CollectionProperty headers = headerManager.getHeaders();
-        if (headers != null) {
-            for (final JMeterProperty jMeterProperty : headers) {
-                allHeaders.add((Header) jMeterProperty.getObjectValue());
+        if (headerManager != null) {
+            final CollectionProperty headers = headerManager.getHeaders();
+            if (headers != null) {
+                final List<Header> allHeaders = new ArrayList<>(headers.size());
+                for (final JMeterProperty jMeterProperty : headers) {
+                    allHeaders.add((Header) jMeterProperty.getObjectValue());
+                }
+                return allHeaders.toArray(new Header[allHeaders.size()]);
             }
         }
-        return allHeaders.toArray(new Header[allHeaders.size()]);
+        return new Header[0];
     }
 
     protected void disconnect(HttpURLConnection conn) {



Mime
View raw message