DefaultTransport.put() has inverted file existence check
Found in: maven-4.0.x branch (up to commit 5ef0ac2)
File: impl/maven-impl/src/main/java/org/apache/maven/impl/transport/DefaultTransport.java (line 101)
Severity: Critical
Description
The put() method has an inverted condition on the file existence check:
if (Files.isRegularFile(source)) {
throw new IllegalArgumentException("source file does not exist or is not a file");
}
Files.isRegularFile(source) returns true when the source IS a regular file (exists and is valid), but the error message says the file "does not exist or is not a file". The condition should use !Files.isRegularFile(source).
This bug makes the put() method impossible to use with any valid file argument — it will always throw IllegalArgumentException for legitimate files, silently succeeding only for directories, symlinks, or non-existent paths (which will then fail downstream). The entire transport upload mechanism is effectively broken.
Expected behavior
The condition should be negated:
if (!Files.isRegularFile(source)) {
throw new IllegalArgumentException("source file does not exist or is not a file");
}
DefaultTransport.put() has inverted file existence check
Found in: maven-4.0.x branch (up to commit 5ef0ac2)
File:
impl/maven-impl/src/main/java/org/apache/maven/impl/transport/DefaultTransport.java(line 101)Severity: Critical
Description
The
put()method has an inverted condition on the file existence check:Files.isRegularFile(source)returnstruewhen the source IS a regular file (exists and is valid), but the error message says the file "does not exist or is not a file". The condition should use!Files.isRegularFile(source).This bug makes the
put()method impossible to use with any valid file argument — it will always throwIllegalArgumentExceptionfor legitimate files, silently succeeding only for directories, symlinks, or non-existent paths (which will then fail downstream). The entire transport upload mechanism is effectively broken.Expected behavior
The condition should be negated: