diff --git a/src/main/java/org/openrewrite/xml/liberty/PersistenceXmlLocationRule.java b/src/main/java/org/openrewrite/xml/liberty/PersistenceXmlLocationRule.java index 2783885..228abf8 100644 --- a/src/main/java/org/openrewrite/xml/liberty/PersistenceXmlLocationRule.java +++ b/src/main/java/org/openrewrite/xml/liberty/PersistenceXmlLocationRule.java @@ -51,7 +51,7 @@ public File getProjectDirectory(File sourceFile, String projectName) { } public List getSrcDirectories(SourceFile sourceFile) { - List srcDirs = new ArrayList(); + List srcDirs = new ArrayList<>(); Path sourcePath = sourceFile.getSourcePath(); String projectName = sourceFile.getMarkers() @@ -65,7 +65,7 @@ public List getSrcDirectories(SourceFile sourceFile) { if (subDirs != null) { for (File subDir : subDirs) { String dirName = subDir.getName().toLowerCase(); - if (dirName.endsWith("src") || dirName.equals("source")) { + if (dirName.endsWith("src") || "source".equals(dirName)) { srcDirs.add(subDir); } } @@ -82,10 +82,10 @@ public TreeVisitor getVisitor() { @Override public Tree visit(@Nullable Tree tree, ExecutionContext ctx) { if (tree instanceof SourceFile) { - SourceFile sourceFile = ((SourceFile) tree); + SourceFile sourceFile = (SourceFile) tree; Path sourcePath = ((SourceFile) tree).getSourcePath(); - if (sourcePath.getFileName().toString().equals("persistence.xml")) { + if ("persistence.xml".equals(sourcePath.getFileName().toString())) { String projectName = sourceFile.getMarkers() .findFirst(JavaProject.class) .map(JavaProject::getProjectName)