2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-26 00:37:10 -07:00

Flipped String equals to avoid potential null pointer exception

This commit is contained in:
Erik C. Thauvin 2023-09-15 05:19:51 -07:00
parent e69f4fe554
commit 762a63b12f
6 changed files with 14 additions and 14 deletions

View file

@ -147,7 +147,7 @@ public record Dependency(String groupId, String artifactId, VersionNumber versio
if (!classifier.isEmpty()) {
result.append(":").append(classifier);
}
if (!type.isEmpty() && !type.equals("jar")) {
if (!type.isEmpty() && !"jar".equals(type)) {
result.append("@").append(type);
}
return result.toString();

View file

@ -25,10 +25,10 @@ public record DependencyExclusion(String groupId, String artifactId) {
}
boolean matches(PomDependency dependency) {
return (groupId().equals("*") && artifactId().equals("*")) ||
(groupId().equals("*") && artifactId().equals(dependency.artifactId())) ||
(groupId().equals(dependency.groupId()) && artifactId().equals("*")) ||
(groupId().equals(dependency.groupId()) && artifactId().equals(dependency.artifactId()));
return ("*".equals(groupId()) && "*".equals(artifactId())) ||
("*".equals(groupId()) && artifactId().equals(dependency.artifactId())) ||
(groupId().equals(dependency.groupId()) && "*".equals(artifactId())) ||
(groupId().equals(dependency.groupId()) && dependency.artifactId().equals(artifactId()));
}
}

View file

@ -287,19 +287,19 @@ class Xml2MavenPom extends Xml2Data {
}
private boolean isChildOfProject() {
return elementStack_.peek().equals("project");
return "project".equals(elementStack_.peek());
}
private boolean isChildOfParent() {
return elementStack_.peek().equals("parent");
return "parent".equals(elementStack_.peek());
}
private boolean isChildOfDependency() {
return elementStack_.peek().equals("dependency");
return "dependency".equals(elementStack_.peek());
}
private boolean isChildOfExclusion() {
return elementStack_.peek().equals("exclusion");
return "exclusion".equals(elementStack_.peek());
}
private void addProjectProperty(String name) {

View file

@ -34,7 +34,7 @@ public class JUnitOperation extends TestOperation<JUnitOperation, JUnitOptions>
}
// add the default JUnit options if none were specified
if (testToolOptions().isEmpty() && mainClass().equals(DEFAULT_TEST_TOOL_JUNIT5)) {
if (testToolOptions().isEmpty() && DEFAULT_TEST_TOOL_JUNIT5.equals(mainClass())) {
testToolOptions().defaultOptions();
}
@ -45,9 +45,9 @@ public class JUnitOperation extends TestOperation<JUnitOperation, JUnitOptions>
var argument = arguments.get(0);
if (argument.startsWith("-")) {
arguments.remove(0);
if (argument.equals("--junit-help")) {
if ("--junit-help".equals(argument)) {
testToolOptions().add("--help");
} else if (argument.equals("--junit-clear")) {
} else if ("--junit-clear".equals(argument)) {
testToolOptions().clear();
} else {
testToolOptions().add(argument);

View file

@ -151,7 +151,7 @@ public class PomBuilder {
t.blankValue("dependency-type");
t.blankValue("dependency-type-tag");
if (!dependency.type().equals("jar")) {
if (!"jar".equals(dependency.type())) {
t.setValueEncoded("dependency-type", dependency.type());
t.setBlock("dependency-type-tag");
}

View file

@ -496,7 +496,7 @@ public class Wrapper {
private int launchMain(File jarFile, List<String> arguments)
throws IOException, InterruptedException, FileUtilsErrorException {
if (arguments.isEmpty() || !arguments.get(0).equals("--build")) {
if (arguments.isEmpty() || !"--build".equals(arguments.get(0))) {
return launchMainCli(jarFile, arguments);
}
return launchMainBuild(jarFile, arguments);