Skip to content

Commit 99f5b4d

Browse files
committed
Add more nullability annotations to module/spring-boot-data-redis
See gh-46587
1 parent 3afbe84 commit 99f5b4d

File tree

1 file changed

+12
-4
lines changed
  • module/spring-boot-data-redis/src/main/java/org/springframework/boot/data/redis/health

1 file changed

+12
-4
lines changed

module/spring-boot-data-redis/src/main/java/org/springframework/boot/data/redis/health/RedisHealth.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,18 @@ static Health.Builder up(Health.Builder builder, Properties info) {
3838
}
3939

4040
static Health.Builder fromClusterInfo(Health.Builder builder, ClusterInfo clusterInfo) {
41-
builder.withDetail("cluster_size", clusterInfo.getClusterSize());
42-
builder.withDetail("slots_up", clusterInfo.getSlotsOk());
43-
builder.withDetail("slots_fail", clusterInfo.getSlotsFail());
44-
41+
Long clusterSize = clusterInfo.getClusterSize();
42+
if (clusterSize != null) {
43+
builder.withDetail("cluster_size", clusterSize);
44+
}
45+
Long slotsOk = clusterInfo.getSlotsOk();
46+
if (slotsOk != null) {
47+
builder.withDetail("slots_up", slotsOk);
48+
}
49+
Long slotsFail = clusterInfo.getSlotsFail();
50+
if (slotsFail != null) {
51+
builder.withDetail("slots_fail", slotsFail);
52+
}
4553
if ("fail".equalsIgnoreCase(clusterInfo.getState())) {
4654
return builder.down();
4755
}

0 commit comments

Comments
 (0)