This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch red in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
commit 932692dc7caa11864ac6b358e796d7500ffb41b8 Author: Elliotte Rusty Harold <[email protected]> AuthorDate: Thu Jan 8 18:37:42 2026 -0500 Remove redundant local variables --- .../org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java b/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java index ceb8e98..c6aba5b 100644 --- a/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java +++ b/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java @@ -112,14 +112,12 @@ public class ExcludeViolationsFromFile implements ExcludeFromFile<Violation> { if (packageName != null && !packageName.isEmpty() && className != null && !className.isEmpty()) { return packageName + "." + className; } else if (packageName != null && !packageName.isEmpty()) { - String fileName = fullPath; - fileName = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1); + String fileName = fullPath.substring(fullPath.lastIndexOf(File.separatorChar) + 1); fileName = fileName.substring(0, fileName.length() - 5); return packageName + "." + fileName; } else { - final String fileName = fullPath; - final int javaIdx = fileName.indexOf(File.separator + "java" + File.separator); - return fileName.substring(javaIdx >= 0 ? javaIdx + 6 : 0, fileName.length() - 5) + final int javaIdx = fullPath.indexOf(File.separator + "java" + File.separator); + return fullPath.substring(javaIdx >= 0 ? javaIdx + 6 : 0, fullPath.length() - 5) .replace(File.separatorChar, '.'); } }
