Insert null checks

This commit is contained in:
Florian Reimair 2019-02-01 12:58:58 +01:00
parent f066fc2413
commit d13dceb4ab
2 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,8 @@
package bisq.monitor.metric;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
@ -243,6 +245,8 @@ public class P2PNetworkLoad extends Metric implements MessageListener, SetupList
});
}
checkNotNull(connection.peersNodeAddressProperty(),
"although the property is nullable, we need it to not be null");
bucketsPerHost.put(connection.peersNodeAddressProperty().getValue(), buckets);
connection.removeMessageListener(this);

View File

@ -17,6 +17,8 @@
package bisq.monitor.metric;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@ -209,6 +211,8 @@ public class P2PNetworkMessageSnapshot extends Metric implements MessageListener
});
}
checkNotNull(connection.peersNodeAddressProperty(),
"although the property is nullable, we need it to not be null");
bucketsPerHost.put(connection.peersNodeAddressProperty().getValue(), buckets);
connection.removeMessageListener(this);