gnodet commented on code in PR #410:
URL: https://github.com/apache/maven-archiver/pull/410#discussion_r4144330450
##########
src/main/java/org/apache/maven/shared/archiver/MavenArchiver.java:
##########
@@ -723,7 +723,16 @@ private static boolean isNumeric(String str) {
return false;
}
- for (char c : str.toCharArray()) {
+ int start = 0;
+ if (str.charAt(0) == '-') {
+ if (str.length() == 1) {
+ return false; // lone "-" is not numeric (used as disable
sentinel in POM inheritance)
+ }
+ start = 1;
Review Comment:
It doesn't throw away the minus — it skips it for the digit-check loop only.
`isNumeric()` is a predicate that answers "does this string represent an
integer?". Since `-` is not a digit (`c < '0' || c > '9'` would be true), the
old loop would always return `false` for any negative number. Setting `start =
1` makes the loop verify only the digit portion (`"-1"` → checks `"1"`,
`"-315532802"` → checks `"315532802"`). The full original string (including the
`-`) is then passed to `Long.parseLong()` downstream, so the sign is preserved
end-to-end.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]