elharo opened a new issue, #12604:
URL: https://github.com/apache/maven/issues/12604
# DefaultSettingsBuilder: Dead Windows drive-relative path handling
**Found in:** maven-4.0.x branch
**File:**
`impl/maven-impl/src/main/java/org/apache/maven/impl/settings/DefaultSettingsBuilder.java`
(lines 131-137)
**Severity:** Medium
## Description
The check for drive-relative Windows paths is always false on all platforms:
```java
if (localRepository != null && !localRepository.isEmpty()) {
Path file = Paths.get(localRepository);
if (!file.isAbsolute() && file.toString().startsWith(File.separator)) {
effective =
effective.withLocalRepository(file.toAbsolutePath().toString());
}
}
```
On Windows, a path starting with `\` (e.g., `\foo\bar`) is already absolute
(relative to the current drive root), so `file.isAbsolute()` returns true and
the inner condition fails. On Unix (`/` separator), any path starting with `/`
is also absolute. This means the condition `!file.isAbsolute() &&
file.toString().startsWith(File.separator)` is **always false**, making the
entire block dead code. The intended fix for drive-relative paths is never
executed.
--
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]