jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1720026 - in /jmeter/trunk/src: core/org/apache/jmeter/services/FileServer.java protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
Date Mon, 14 Dec 2015 22:28:10 GMT
Author: sebb
Date: Mon Dec 14 22:28:10 2015
New Revision: 1720026

URL: http://svn.apache.org/viewvc?rev=1720026&view=rev
Log:
Safer to check for null array and skip pre-check

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java?rev=1720026&r1=1720025&r2=1720026&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java Mon Dec 14 22:28:10 2015
@@ -509,8 +509,8 @@ public class FileServer {
         File input = null;
         if (basedir != null) {
             File src = new File(basedir);
-            if (src.isDirectory() && src.list() != null) {
-                File[] lfiles = src.listFiles(new JMeterFileFilter(extensions));
+            File[] lfiles = src.listFiles(new JMeterFileFilter(extensions));
+            if (lfiles != null) {
                 // lfiles cannot be null as it has been checked before
                 int count = lfiles.length;
                 input = lfiles[ThreadLocalRandom.current().nextInt(count)];

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java?rev=1720026&r1=1720025&r2=1720026&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
Mon Dec 14 22:28:10 2015
@@ -159,8 +159,8 @@ public class WebServiceSampler extends H
     protected String getRandomFileName() {
         if (this.getXmlPathLoc() != null) {
             File src = new File(this.getXmlPathLoc());
-            if (src.isDirectory() && src.list() != null) {
-                File [] fileList = src.listFiles(new JMeterFileFilter(new String[] { ".xml"
}, false));
+            File [] fileList = src.listFiles(new JMeterFileFilter(new String[] { ".xml" },
false));
+            if (fileList != null) {
                 // fileList cannot be null as we checked it
                 File one = fileList[ThreadLocalRandom.current().nextInt(fileList.length)];
                 // return the absolutePath of the file



Mime
View raw message