Author: pmouawad
Date: Mon Sep 3 19:59:14 2012
New Revision: 1380327
URL: http://svn.apache.org/viewvc?rev=1380327&view=rev
Log:
Use JOrphanUtils#isBlank
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHCAbstractImpl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java?rev=1380327&r1=1380326&r2=1380327&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
Mon Sep 3 19:59:14 2012
@@ -40,6 +40,7 @@ import org.apache.jmeter.testelement.pro
import org.apache.jmeter.testelement.property.TestElementProperty;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.util.JOrphanUtils;
import org.apache.log.Logger;
// For Unit tests, @see TestAuthManager
@@ -244,7 +245,7 @@ public class AuthManager extends ConfigT
String line;
while ((line = reader.readLine()) != null) {
try {
- if (line.startsWith("#") || line.trim().length() == 0) { //$NON-NLS-1$
+ if (line.startsWith("#") || JOrphanUtils.isBlank(line)) { //$NON-NLS-1$
continue;
}
StringTokenizer st = new StringTokenizer(line, "\t"); //$NON-NLS-1$
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java?rev=1380327&r1=1380326&r2=1380327&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
Mon Sep 3 19:59:14 2012
@@ -198,7 +198,7 @@ public class CookieManager extends Confi
final CollectionProperty cookies = getCookies();
while ((line = reader.readLine()) != null) {
try {
- if (line.startsWith("#") || line.trim().length() == 0) {//$NON-NLS-1$
+ if (line.startsWith("#") || JOrphanUtils.isBlank(line)) {//$NON-NLS-1$
continue;
}
String[] st = JOrphanUtils.split(line, TAB, false);
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java?rev=1380327&r1=1380326&r2=1380327&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java
Mon Sep 3 19:59:14 2012
@@ -138,7 +138,7 @@ public class HeaderManager extends Confi
String line;
while ((line = reader.readLine()) != null) {
try {
- if (line.startsWith("#") || line.trim().length() == 0) {// $NON-NLS-1$
+ if (line.startsWith("#") || JOrphanUtils.isBlank(line)) {// $NON-NLS-1$
continue;
}
String[] st = JOrphanUtils.split(line, "\t", " ");// $NON-NLS-1$ $NON-NLS-2$
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHCAbstractImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHCAbstractImpl.java?rev=1380327&r1=1380326&r2=1380327&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHCAbstractImpl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHCAbstractImpl.java
Mon Sep 3 19:59:14 2012
@@ -29,6 +29,7 @@ import java.util.StringTokenizer;
import org.apache.jmeter.JMeter;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.util.JOrphanUtils;
import org.apache.log.Logger;
/**
@@ -140,7 +141,7 @@ public abstract class HTTPHCAbstractImpl
* @return {@code true} iff both ProxyPort and ProxyHost are defined.
*/
protected boolean isDynamicProxy(String proxyHost, int proxyPort){
- return (proxyHost.trim().length() > 0 && proxyPort > 0);
+ return (!JOrphanUtils.isBlank(proxyHost) && proxyPort > 0);
}
/**
@@ -158,6 +159,6 @@ public abstract class HTTPHCAbstractImpl
* @return true if value is null or empty trimmed
*/
protected static boolean isNullOrEmptyTrimmed(String value) {
- return value == null || value.trim().length() == 0;
+ return JOrphanUtils.isBlank(value);
}
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1380327&r1=1380326&r2=1380327&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Mon Sep 3 19:59:14 2012
@@ -929,7 +929,7 @@ public abstract class HTTPSamplerBase ex
*/
public String getQueryString(String contentEncoding) {
// Check if the sampler has a specified content encoding
- if(contentEncoding == null || contentEncoding.trim().length() == 0) {
+ if(JOrphanUtils.isBlank(contentEncoding)) {
// We use the encoding which should be used according to the HTTP spec, which
is UTF-8
contentEncoding = EncoderCache.URL_ARGUMENT_ENCODING;
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java?rev=1380327&r1=1380326&r2=1380327&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
Mon Sep 3 19:59:14 2012
@@ -19,6 +19,7 @@
package org.apache.jmeter.protocol.http.sampler;
import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.util.JOrphanUtils;
/**
* Factory to return the appropriate HTTPSampler for use with classes that need
@@ -90,7 +91,7 @@ public final class HTTPSamplerFactory {
if (HTTPSamplerBase.PROTOCOL_FILE.equals(base.getProtocol())) {
return new HTTPFileImpl(base);
}
- if (impl.trim().length() == 0){
+ if (JOrphanUtils.isBlank(impl)){
impl = DEFAULT_CLASSNAME;
}
if (IMPL_JAVA.equals(impl) || HTTP_SAMPLER_JAVA.equals(impl)) {
|