elharo opened a new issue, #12583:
URL: https://github.com/apache/maven/issues/12583
# 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:
```java
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:
```java
if (!Files.isRegularFile(source)) {
throw new IllegalArgumentException("source file does not exist or is not
a file");
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]