apache / apache/maven-archiver
loadOptionalProperties silently swallows all errors including corrupt pom.properties
- Dominant language
- Java
- Stars
- 13
- Forks
- 26
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 7
Description
**Affected version:** all
**Description:**
`MavenArchiver.loadOptionalProperties()` at line 622 catches both `IllegalArgumentException` and `IOException` and ignores them:
```java
private static Properties loadOptionalProperties(final InputStream inputStream) {
Properties properties = new Properties();
if (inputStream != null) {
try (InputStream in = inputStream) {
properties.load(in);
} catch (IllegalArgumentException | IOException ex) {
// ignore and return empty properties
}
}
return properties;
}
```
If the `/META-INF/maven/.../pom.properties` resource exists on the classpath but is corrupt (e.g., truncated, malformed encoding), the error is silently swallowed and an empty Properties object is returned. This causes the plugin version to resolve as `null`, which may produce different behavior (e.g., "Maven Archiver" vs "Maven Archiver 3.7.0") without any indication of the underlying data corruption.
Raising as low priority since this is a classpath resource packaged with the library itself (not user-supplied), but silent data loss is never ideal.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at MavenArchiver.loadOptionalProperties() around line 622 and inspect how its returned Properties value is used when resolving the plugin version. Trace existing tests or add focused coverage for a corrupt pom.properties resource; done means corruption is no longer silently converted into an empty Properties object and the intended failure or reporting behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100