Skip to content
Permalink
Browse files
Use isEmpty instead of comparing length to zero
  • Loading branch information
FSchumacher committed Mar 5, 2022
1 parent f8b22b3 commit 765afaf5db878bde8bbdeb721229b53963e38c10
Showing 1 changed file with 7 additions and 7 deletions.
@@ -835,7 +835,7 @@ private void checkPostRequestUrlEncoded(
String descriptionField,
String descriptionValue,
boolean valuesAlreadyUrlEncoded) throws IOException {
if (contentEncoding == null || contentEncoding.length() == 0) {
if (contentEncoding == null || contentEncoding.isEmpty()) {
contentEncoding = samplerDefaultEncoding;
}
// Check URL
@@ -867,7 +867,7 @@ private void checkPostRequestFormMultipart(
String titleValue,
String descriptionField,
String descriptionValue) throws IOException {
if (contentEncoding == null || contentEncoding.length() == 0) {
if (contentEncoding == null || contentEncoding.isEmpty()) {
contentEncoding = samplerDefaultEncoding;
}
// Check URL
@@ -916,7 +916,7 @@ private void checkPostRequestFileUpload(
File fileValue,
String fileMimeType,
byte[] fileContent) throws IOException {
if (contentEncoding == null || contentEncoding.length() == 0) {
if (contentEncoding == null || contentEncoding.isEmpty()) {
contentEncoding = samplerDefaultEncoding;
}
// Check URL
@@ -956,7 +956,7 @@ private void checkPostRequestBody(
String contentEncoding,
String expectedPostBody,
String expectedContentType) throws IOException {
if (contentEncoding == null || contentEncoding.length() == 0) {
if (contentEncoding == null || contentEncoding.isEmpty()) {
contentEncoding = samplerDefaultEncoding;
}
// Check URL
@@ -1037,7 +1037,7 @@ private void checkGetRequest_Parameters(
String descriptionField,
String descriptionValue,
boolean valuesAlreadyUrlEncoded) throws IOException {
if (contentEncoding == null || contentEncoding.length() == 0) {
if (contentEncoding == null || contentEncoding.isEmpty()) {
contentEncoding = EncoderCache.URL_ARGUMENT_ENCODING;
}
// Check URL
@@ -1093,7 +1093,7 @@ private void checkMethodPathQuery(
assertEquals(expectedMethod, methodSent);
String uriSent = headersSent.substring(indexFirstSpace + 1, indexSecondSpace);
int indexQueryStart = uriSent.indexOf('?');
if (expectedQueryString != null && expectedQueryString.length() > 0) {
if (expectedQueryString != null && !expectedQueryString.isEmpty()) {
// We should have a query string part
if (indexQueryStart <= 0 || indexQueryStart == uriSent.length() - 1) {
fail("Could not find query string in URI");
@@ -1110,7 +1110,7 @@ private void checkMethodPathQuery(
String pathSent = uriSent.substring(0, indexQueryStart);
assertEquals(expectedPath, pathSent);
// Check query
if (expectedQueryString != null && expectedQueryString.length() > 0) {
if (expectedQueryString != null && !expectedQueryString.isEmpty()) {
String queryStringSent = uriSent.substring(indexQueryStart + 1);
// Is it only the parameter values which are encoded in the specified
// content encoding, the rest of the query is encoded in UTF-8

0 comments on commit 765afaf

Please sign in to comment.