You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/02/22 22:10:23 UTC

(maven-enforcer) branch bug created (now 43c8cab)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a change to branch bug
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git


      at 43c8cab  Simplify control flow

This branch includes the following new commits:

     new 43c8cab  Simplify control flow

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-enforcer) 01/01: Simplify control flow

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch bug
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git

commit 43c8cabc94a16218813039038449caf89a783d5d
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sat Feb 22 17:10:07 2025 -0500

    Simplify control flow
---
 .../org/apache/maven/enforcer/rules/files/RequireFilesDontExist.java    | 2 +-
 .../java/org/apache/maven/enforcer/rules/files/RequireFilesExist.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesDontExist.java b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesDontExist.java
index 116dd04..539bd45 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesDontExist.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesDontExist.java
@@ -30,7 +30,7 @@ public final class RequireFilesDontExist extends AbstractRequireFiles {
     @Override
     boolean checkFile(File file) {
         // if we get here and the handle is null, treat it as a success
-        return file == null ? true : !file.exists();
+        return file == null || !file.exists();
     }
 
     @Override
diff --git a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesExist.java b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesExist.java
index 265cf25..a34ef90 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesExist.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/files/RequireFilesExist.java
@@ -31,7 +31,7 @@ public final class RequireFilesExist extends AbstractRequireFiles {
     @Override
     boolean checkFile(File file) {
         // if we get here and the handle is null, treat it as a success
-        return file == null ? true : file.exists() && osIndependentNameMatch(file);
+        return file == null || (file.exists() && osIndependentNameMatch(file));
     }
 
     @Override