You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/21 10:23:09 UTC
[I] waitAfterFailure produces negative exponent for Integer.MIN_VALUE attempt [maven-jarsigner-plugin]
elharo opened a new issue, #152:
URL: https://github.com/apache/maven-jarsigner-plugin/issues/152
**Affected version:** HEAD
**File:** `src/main/java/org/apache/maven/plugins/jarsigner/JarsignerSignMojo.java:414-428`
The `waitAfterFailure()` method uses `Math.min(attempt, MAX_WAIT_EXPONENT_ATTEMPT)` where `MAX_WAIT_EXPONENT_ATTEMPT = 20`. For negative attempt values (e.g., `Integer.MIN_VALUE`), this produces a negative exponent:
```java
int exponentAttempt = Math.min(attempt, MAX_WAIT_EXPONENT_ATTEMPT);
long delayMillis = (long) (Duration.ofSeconds(1).toMillis() * Math.pow(2, exponentAttempt));
```
For `attempt = Integer.MIN_VALUE`, `Math.min(Integer.MIN_VALUE, 20)` = `Integer.MIN_VALUE`, and `Math.pow(2, Integer.MIN_VALUE)` returns a fractional value near 0, so the resulting `delayMillis` is 0. While this doesn't cause a crash, the pattern is fragile and produces unexpected behavior for edge-case inputs. The fix should clamp `attempt` to at least 0.
--
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: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] waitAfterFailure produces negative exponent for Integer.MIN_VALUE attempt [maven-jarsigner-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed issue #152: waitAfterFailure produces negative exponent for Integer.MIN_VALUE attempt
URL: https://github.com/apache/maven-jarsigner-plugin/issues/152
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org