jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1847959 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
Date Sun, 02 Dec 2018 11:04:09 GMT
Author: fschumacher
Date: Sun Dec  2 11:04:09 2018
New Revision: 1847959

URL: http://svn.apache.org/viewvc?rev=1847959&view=rev
Log:
Use StringUtils.isNotBlank to make intent clearer

Part of #435 and Bugzilla Id: 62972

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

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java?rev=1847959&r1=1847958&r2=1847959&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
Sun Dec  2 11:04:09 2018
@@ -197,8 +197,8 @@ public class AccessLogSampler extends HT
     public void instantiateParser() {
         if (parser == null) {
             try {
-                if (this.getParserClassName() != null && this.getParserClassName().length()
> 0) {
-                    if (this.getLogFile() != null && this.getLogFile().length() >
0) {
+                if (StringUtils.isNotBlank(this.getParserClassName())) {
+                    if (StringUtils.isNotBlank(this.getLogFile())) {
                         parser = (LogParser) Class.forName(getParserClassName()).newInstance();
                         parser.setSourceFile(this.getLogFile());
                         parser.setFilter(filter);
@@ -306,7 +306,7 @@ public class AccessLogSampler extends HT
     }
 
     protected void initFilter() {
-        if (filter == null && filterClassName != null && filterClassName.length()
> 0) {
+        if (filter == null && StringUtils.isNotBlank(filterClassName)) {
             try {
                 filter = (Filter) Class.forName(filterClassName).newInstance();
             } catch (Exception e) {
@@ -321,26 +321,24 @@ public class AccessLogSampler extends HT
     @Override
     public Object clone() {
         AccessLogSampler s = (AccessLogSampler) super.clone();
-        if (started) {
-            if (filterClassName != null && filterClassName.length() > 0) {
+        if (started && StringUtils.isNotBlank(filterClassName)) {
 
-                try {
-                    if (TestCloneable.class.isAssignableFrom(Class.forName(filterClassName)))
{
-                        initFilter();
-                        s.filter = (Filter) ((TestCloneable) filter).clone();
-                    }
-                    if (TestCloneable.class.isAssignableFrom(Class.forName(parserClassName)))
+            try {
+                if (TestCloneable.class.isAssignableFrom(Class.forName(filterClassName)))
{
+                    initFilter();
+                    s.filter = (Filter) ((TestCloneable) filter).clone();
+                }
+                if (TestCloneable.class.isAssignableFrom(Class.forName(parserClassName)))
+                {
+                    instantiateParser();
+                    s.parser = (LogParser)((TestCloneable)parser).clone();
+                    if (filter != null)
                     {
-                        instantiateParser();
-                        s.parser = (LogParser)((TestCloneable)parser).clone();
-                        if (filter != null)
-                        {
-                            s.parser.setFilter(s.filter);
-                        }
+                        s.parser.setFilter(s.filter);
                     }
-                } catch (Exception e) {
-                    log.warn("Could not clone cloneable filter", e);
                 }
+            } catch (Exception e) {
+                log.warn("Could not clone cloneable filter", e);
             }
         }
         return s;



Mime
View raw message