apache / apache/maven-ear-plugin

removeFromOutdatedResources() fallback path never matches due to path mismatch

Open
#518 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
14
Forks
29
Avg merge
1d 12h
Merged PRs (30d)
6

Description

## Description

In `EarMojo.java:886-897`, the `removeFromOutdatedResources()` method has a fallback path that will never match:

```java
try {
relativeDestFile = getWorkDirectory().toPath().relativize(destination.normalize());
} catch (ProviderMismatchException e) {
relativeDestFile = destination.normalize(); // absolute path
}
if (outdatedResources.remove(relativeDestFile.toString())) { ... }
```

When a `ProviderMismatchException` occurs (e.g., zip filesystem path vs local filesystem path), the fallback stores an absolute path. However, `outdatedResources` contains only relative paths (from `initOutdatedResources()` at line 857). The `remove()` will never match, so cleanup silently fails for those paths.

## Expected behavior

Attempt to relativize differently, or at minimum log that cleanup could not be performed for that path.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in EarMojo.java:886-897 and inspect initOutdatedResources() around line 857 to compare the stored relative paths with the fallback path. Reproduce the ProviderMismatchException case involving zip and local filesystem paths. Done means cleanup can match the outdated resource, or clearly logs when cleanup cannot be performed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.