commit | 2994a6a74b5488ec96101ee639550579d1845f69 | [log] [tgz] |
---|---|---|
author | Jacek Centkowski <geminica.programs@gmail.com> | Tue May 09 16:58:50 2023 +0100 |
committer | Jacek Centkowski <geminica.programs@gmail.com> | Tue May 09 16:58:50 2023 +0100 |
tree | b655d35c2c51da1029486984d243dc61a7fc6dc1 | |
parent | aac48c3432442c3b2be535367e585bab1322c1c1 [diff] |
Fix AccountLimitsConfig error prone error The following error was fixed: error: [ImpossibleNullComparison] This value cannot be null, and comparing it to null may be misleading. return Optional.ofNullable(rateLimits.row(type)); ^ Change-Id: Iffc891f138b70bbfc38c004f1081476e4c7569ec
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java index 9c94fae..504dd2f 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java +++ b/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java
@@ -188,9 +188,6 @@ * @return map of rate limits per group name */ Optional<Map<String, RateLimit>> getRatelimits(Type type) { - if (rateLimits != null) { - return Optional.ofNullable(rateLimits.row(type)); - } - return Optional.empty(); + return Optional.ofNullable(rateLimits).map(limits -> limits.row(type)); } }