Refactored some null checks

This commit is contained in:
Matthias Dhellin 2024-10-07 17:32:12 +02:00
parent e4b212f30e
commit 561b9b6a1f
1 changed files with 10 additions and 12 deletions

View File

@ -286,18 +286,16 @@ public class BackrollClient {
BackrollVmMetricsResponse vmMetricsResponse = waitGet(urlToRequest);
if (vmMetricsResponse != null) {
if (vmMetricsResponse.state.equals(TaskState.SUCCESS)) {
LOG.debug("SUCCESS ok");
if (vmMetricsResponse.infos != null) {
if (vmMetricsResponse.infos.cache != null) {
if (vmMetricsResponse.infos.cache.stats != null) {
CacheStats stats = vmMetricsResponse.infos.cache.stats;
long size = Long.parseLong(stats.totalSize);
return new Metric(size, size);
}
}
}
if (vmMetricsResponse != null && vmMetricsResponse.state.equals(TaskState.SUCCESS)) {
LOG.debug("SUCCESS ok");
CacheStats stats = null;
try {
stats = vmMetricsResponse.infos.cache.stats;
} catch (NullPointerException e) {
}
if (stats != null) {
long size = Long.parseLong(stats.totalSize);
return new Metric(size, size);
}
}
} catch (final Exception e) {