diff --git a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/CustomDecoratedLauncher.java b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/CustomDecoratedLauncher.java index 069f3dc..fac99ad 100644 --- a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/CustomDecoratedLauncher.java +++ b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/CustomDecoratedLauncher.java @@ -2,7 +2,7 @@ import hudson.Launcher; import hudson.Proc; -import org.apache.commons.lang.StringUtils; +import hudson.Util; import javax.annotation.Nonnull; import java.io.IOException; @@ -27,7 +27,7 @@ public CustomDecoratedLauncher(@Nonnull Launcher inner, Collection passw int nbMaskedPasswords = 0; for(String password: passwords) { - if(StringUtils.isNotEmpty(password)) { + if(Util.fixEmpty(password) != null) { regex.append(Pattern.quote(password)); regex.append('|'); try { diff --git a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/TcTestBuilder.java b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/TcTestBuilder.java index b46d682..d319b11 100644 --- a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/TcTestBuilder.java +++ b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/TcTestBuilder.java @@ -49,7 +49,7 @@ import jenkins.tasks.SimpleBuildStep; import net.sf.json.JSONObject; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; +import hudson.Util; import org.jenkinsci.Symbol; import org.jenkinsci.plugins.plaincredentials.StringCredentials; import org.kohsuke.stapler.*; @@ -517,7 +517,7 @@ public BuildStepMonitor getRequiredMonitorService() { } public boolean usingOldCredentials() { - return ((!StringUtils.isEmpty(getUserName())) || (!StringUtils.isEmpty(getUserPassword().getPlainText()))) && (StringUtils.isEmpty(getCredentialsId())); + return ((Util.fixEmpty(getUserName()) != null) || (Util.fixEmpty(getUserPassword().getPlainText()) != null)) && (Util.fixEmpty(getCredentialsId()) == null); } private int fixExitCode(int exitCode, Workspace workspace, TaskListener listener) throws IOException, InterruptedException { @@ -985,7 +985,7 @@ private ArgumentListBuilder prepareServiceCommandLine(Run run, TaskListene } else { String credentialsId = env.expand(getCredentialsId()); - if (!StringUtils.isEmpty(credentialsId)) { + if (Util.fixEmpty(credentialsId) != null) { StandardUsernamePasswordCredentials credentials = CredentialsProvider.findCredentialById(credentialsId, StandardUsernamePasswordCredentials.class, run); if (credentials == null) { @@ -997,7 +997,7 @@ private ArgumentListBuilder prepareServiceCommandLine(Run run, TaskListene } } - if (!StringUtils.isEmpty(userName)) { + if (Util.fixEmpty(userName) != null) { if (userName.contains("\\")) { int pos = userName.lastIndexOf("\\"); domain = userName.substring(0, pos); @@ -1296,7 +1296,7 @@ private ArgumentListBuilder makeCommandLineArgs(Run run, String accessKeyId = env.expand(getAccessKeyId()); - if (!StringUtils.isEmpty(accessKeyId)) { + if (Util.fixEmpty(accessKeyId) != null) { StringCredentials credentials = CredentialsProvider.findCredentialById(accessKeyId, StringCredentials.class, run); if (credentials == null) { @@ -1420,7 +1420,7 @@ public String getPluginName() { @Override public Builder newInstance(StaplerRequest req, @Nonnull JSONObject formData) throws FormException { TcTestBuilder builder = (TcTestBuilder)super.newInstance(req, formData); - if (!StringUtils.isEmpty(builder.getCredentialsId())) { + if (Util.fixEmpty(builder.getCredentialsId()) != null) { builder.setUserName(""); builder.setUserPassword(""); } diff --git a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser.java b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser.java index 6b48015..eeb726d 100644 --- a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser.java +++ b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser.java @@ -29,7 +29,6 @@ import com.smartbear.jenkins.plugins.testcomplete.TcLogInfo; import com.smartbear.jenkins.plugins.testcomplete.Utils; import hudson.model.TaskListener; -import org.apache.commons.lang.StringUtils; import org.w3c.dom.*; import javax.xml.stream.*; @@ -215,7 +214,7 @@ private void convertToXML(ZipFile logArchive, TcLogInfo logInfo, XMLStreamWriter messages.addAll(LogNodeUtils.getWarningMessages(rootOwnerNodeInfo)); } - writer.writeAttribute("message", StringUtils.join(messages, "\n\n")); + writer.writeAttribute("message", String.join("\n\n", messages)); writer.writeEndElement(); //failure } writer.writeEndElement(); //testcase @@ -263,7 +262,7 @@ private void processItem(ZipFile logArchive, Node node, String projectName, XMLS messages.addAll(LogNodeUtils.getWarningMessages(testDetailsNode)); } - writer.writeAttribute("message", StringUtils.join(messages, "\n\n")); + writer.writeAttribute("message", String.join("\n\n", messages)); writer.writeEndElement(); //failure } writer.writeEndElement(); //testcase diff --git a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser2.java b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser2.java index db1c93c..794443b 100644 --- a/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser2.java +++ b/src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser2.java @@ -29,7 +29,6 @@ import com.smartbear.jenkins.plugins.testcomplete.TcLogInfo; import com.smartbear.jenkins.plugins.testcomplete.Utils; import hudson.model.TaskListener; -import org.apache.commons.lang.StringUtils; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -165,7 +164,7 @@ private void convertSingleEntryToXML(ZipFile logArchive, TcLogInfo logInfo, XMLS messages.addAll(LogNodeUtils.getWarningMessages(rootOwnerNodeInfo)); } - writer.writeAttribute("message", StringUtils.join(messages, "\n\n")); + writer.writeAttribute("message", String.join("\n\n", messages)); writer.writeEndElement(); //failure } @@ -245,7 +244,7 @@ private void convertSummaryToXML(Node summaryNode, XMLStreamWriter writer) throw messages.addAll(warnings); } - writer.writeAttribute("message", StringUtils.join(messages, "\n\n")); + writer.writeAttribute("message", String.join("\n\n", messages)); writer.writeEndElement(); //failure }