Skip to content

Commit

Permalink
#591 - Use String.isEmpty()
Browse files Browse the repository at this point in the history
  • Loading branch information
dstenger committed Jan 4, 2024
1 parent 9539b85 commit 3bad689
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions teamengine-core/src/main/java/com/occamlab/te/TECore.java
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ public NodeList soap_request(Document ctlRequest, String id)
static public URLConnection build_soap_request(Node xml) throws Exception {
String sUrl = null;
String method = "POST";
String charset = ((Element) xml).getAttribute("charset").equals("") ? ((Element) xml)
String charset = ((Element) xml).getAttribute("charset").isEmpty() ? ((Element) xml)
.getAttribute("charset") : "UTF-8";
String version = ((Element) xml).getAttribute("version");
String action = "";
Expand Down Expand Up @@ -1654,18 +1654,18 @@ static public URLConnection build_soap_request(Node xml) throws Exception {
uc.setRequestProperty("Accept", "text/xml");
uc.setRequestProperty("SOAPAction", action);
contentType = "text/xml";
if (!charset.equals("")) {
if (!charset.isEmpty()) {
contentType = contentType + "; charset=" + charset;
}
uc.setRequestProperty("Content-Type", contentType);
} else {
// Handle HTTP binding for SOAP 1.2
uc.setRequestProperty("Accept", "application/soap+xml");
contentType = "application/soap+xml";
if (!charset.equals("")) {
if (!charset.isEmpty()) {
contentType = contentType + "; charset=" + charset;
}
if (!action.equals("")) {
if (!action.isEmpty()) {
contentType = contentType + "; action=" + action;
}
uc.setRequestProperty("Content-Type", contentType);
Expand Down Expand Up @@ -1946,7 +1946,7 @@ public URLConnection build_request(Node xml) throws Exception {
if (contentType.equals("application/xml")) {
contentType = "application/xml; charset=" + charset;
}
if (contentType == null || contentType.equals("")) {
if (contentType == null || contentType.isEmpty()) {
contentType = "application/octet-stream";
}

Expand Down Expand Up @@ -2015,7 +2015,7 @@ public URLConnection build_request(Node xml) throws Exception {
// Set headers
if (body != null) {
String mid = ((Element) body).getAttribute("mid");
if (mid != null && !mid.equals("")) {
if (mid != null && !mid.isEmpty()) {
if (mid.indexOf("mid:") != -1) {
mid = mid.substring(mid.indexOf("mid:")
+ "mid:".length());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
package com.occamlab.te.parsers;

import java.io.*;
import java.io.*;
import java.net.URLConnection;

import java.util.logging.Level;
Expand Down Expand Up @@ -73,7 +73,7 @@ public static String getMediaType(String ext) {
}

// Give the media type default of "application/octet-stream"
if (mediaType.equals("")) {
if (mediaType.isEmpty()) {
mediaType = "application/octet-stream";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static String stripNonValidXMLCharacters(String in) {
StringBuffer out = new StringBuffer();
char current;

if (in == null || ("".equals(in)))
if (in == null || (in.isEmpty()))
return "";
for (int i = 0; i < in.length(); i++) {
current = in.charAt(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static Integer getSessionResult(File logFile) {
} else {
Element resultStatus = (Element) testResult.item(0);

if (resultStatus.hasAttribute("result") && !resultStatus.getAttribute("result").equals("")) {
if (resultStatus.hasAttribute("result") && !resultStatus.getAttribute("result").isEmpty()) {
return Integer.parseInt(resultStatus.getAttribute("result"));
} else {
throw new RuntimeException("The 'result' attribute not found or having the NULL value in log file.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public void process(HttpServletRequest request, HttpServletResponse response)
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (!item.isFormField() && !item.getName().equals("")) {
if (!item.isFormField() && !item.getName().isEmpty()) {
File tempDir = new File(URI.create(core
.getTestRunDirectory()));
File uploadedFile = new File(tempDir,
Expand Down

0 comments on commit 3bad689

Please sign in to comment.