apache / apache/maven-archiver

parseBuildOutputTimestamp rejects negative epoch timestamps with misleading error

Open Beginner friendly
#366 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
13
Forks
26
Avg merge
1d 1h
Merged PRs (30d)
7

Description

**Affected version:** 3.6.0+

**Description:**

`parseBuildOutputTimestamp()` at `MavenArchiver.java:690` uses `isNumeric()` to detect integer epoch timestamps, but `isNumeric()` rejects the minus sign:

```java
for (char c : str.toCharArray()) {
if (!Character.isDigit(c)) {
return false;
}
}
```

So `isNumeric(-1)` returns `false`. Execution falls through to the ISO-8601 parser at line 709, which also fails, throwing:

```
IllegalArgumentException("Invalid project.build.outputTimestamp value '-1'")
```

Negative epoch timestamps (seconds before 1970-01-01) are valid per POSIX and could reasonably appear in `SOURCE_DATE_EPOCH` or timestamp configuration.

**Impact:** Valid negative timestamps are rejected with a confusing error message.

**Fix:** Allow an optional leading `-` in the numeric check.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in MavenArchiver.java around line 690 and inspect how isNumeric() classifies epoch timestamps before the ISO-8601 parsing at line 709. Update the behavior so a leading minus sign is accepted, and verify that negative epoch values are parsed successfully instead of producing the invalid-value error.

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
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.