Skip to content

parseBuildOutputTimestamp rejects negative epoch timestamps with misleading error #366

Description

@elharo

Affected version: 3.6.0+

Description:

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions