Replaced empty string equals check with an isEmpty check.

This commit is contained in:
Anthony Whitford
2015-09-09 23:20:51 -07:00
parent ece4a51b94
commit 45658afd89
3 changed files with 5 additions and 5 deletions

View File

@@ -147,7 +147,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
// First, see if there was an error // First, see if there was an error
final String error = xpath.evaluate("/assembly/error", doc); final String error = xpath.evaluate("/assembly/error", doc);
if (error != null && !"".equals(error)) { if (error != null && !error.isEmpty()) {
throw new AnalysisException(error); throw new AnalysisException(error);
} }
@@ -246,7 +246,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream()); final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream());
final XPath xpath = XPathFactory.newInstance().newXPath(); final XPath xpath = XPathFactory.newInstance().newXPath();
final String error = xpath.evaluate("/assembly/error", doc); final String error = xpath.evaluate("/assembly/error", doc);
if (p.waitFor() != 1 || error == null || "".equals(error)) { if (p.waitFor() != 1 || error == null || error.isEmpty()) {
LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details."); LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details.");
LOGGER.debug("GrokAssembly.exe is not working properly"); LOGGER.debug("GrokAssembly.exe is not working properly");
grokAssemblyExe = null; grokAssemblyExe = null;

View File

@@ -339,7 +339,7 @@ public class CPEAnalyzer implements Analyzer {
final String cleanText = cleanseText(searchText); final String cleanText = cleanseText(searchText);
if ("".equals(cleanText)) { if (cleanText.isEmpty()) {
return false; return false;
} }

View File

@@ -132,10 +132,10 @@ public class NexusSearch {
"/org.sonatype.nexus.rest.model.NexusArtifact/pomLink", "/org.sonatype.nexus.rest.model.NexusArtifact/pomLink",
doc); doc);
final MavenArtifact ma = new MavenArtifact(groupId, artifactId, version); final MavenArtifact ma = new MavenArtifact(groupId, artifactId, version);
if (link != null && !"".equals(link)) { if (link != null && !link.isEmpty()) {
ma.setArtifactUrl(link); ma.setArtifactUrl(link);
} }
if (pomLink != null && !"".equals(pomLink)) { if (pomLink != null && !pomLink.isEmpty()) {
ma.setPomUrl(pomLink); ma.setPomUrl(pomLink);
} }
return ma; return ma;