Claudenw commented on code in PR #685:
URL: https://github.com/apache/creadur-rat/pull/685#discussion_r3488564284
##########
apache-rat-core/src/main/java/org/apache/rat/config/results/ClaimValidator.java:
##########
@@ -71,10 +71,10 @@ public boolean hasErrors() {
* @param value the value to set. A negative value specifies no maximum
value.
*/
public void setMax(final ClaimStatistic.Counter counter, final int value) {
- MutableInt maxValue = max.compute(counter, (k, v) -> {
+ MutableInt maxValue = max.computeIfPresent(counter, (k, v) -> {
Review Comment:
My reading of computeIfPresent in light of computeIfAbsent and compute is
that
- computeIfPresent computes a new value if the key is found in the map.
- computeIfAbsent computes a new value if the key is not found in the map.
- compute just computes the value but the BiFunction has to deal with null
values.
I suppose the thing to do here is check for null `counter` argument, log a
warning, and exit.
I will add the null check tomorrow.
--
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]