mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Replace assert statements with AssertionErrors.
This commit is contained in:
@@ -91,7 +91,7 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
||||
public NetworkStatus getNetworkStatus() {
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
appContext.getSystemService(CONNECTIVITY_SERVICE);
|
||||
assert cm != null;
|
||||
if (cm == null) throw new AssertionError();
|
||||
NetworkInfo net = cm.getActiveNetworkInfo();
|
||||
boolean connected = net != null && net.isConnected();
|
||||
boolean wifi = connected && net.getType() == TYPE_WIFI;
|
||||
|
||||
@@ -68,7 +68,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
|
||||
new PoliteExecutor("AndroidLanTcpPlugin", ioExecutor, 1);
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager)
|
||||
appContext.getSystemService(CONNECTIVITY_SERVICE);
|
||||
assert connectivityManager != null;
|
||||
if (connectivityManager == null) throw new AssertionError();
|
||||
this.connectivityManager = connectivityManager;
|
||||
wifiManager = (WifiManager) appContext.getApplicationContext()
|
||||
.getSystemService(WIFI_SERVICE);
|
||||
|
||||
@@ -46,7 +46,7 @@ class SyncRecordReaderImpl implements SyncRecordReader {
|
||||
}
|
||||
|
||||
private void readRecord() throws IOException {
|
||||
assert nextRecord == null;
|
||||
if (nextRecord != null) throw new AssertionError();
|
||||
while (true) {
|
||||
nextRecord = reader.readRecord();
|
||||
// Check the protocol version
|
||||
@@ -62,7 +62,7 @@ class SyncRecordReaderImpl implements SyncRecordReader {
|
||||
}
|
||||
|
||||
private byte getNextRecordType() {
|
||||
assert nextRecord != null;
|
||||
if (nextRecord == null) throw new AssertionError();
|
||||
return nextRecord.getRecordType();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class SyncRecordReaderImpl implements SyncRecordReader {
|
||||
}
|
||||
|
||||
private List<MessageId> readMessageIds() throws IOException {
|
||||
assert nextRecord != null;
|
||||
if (nextRecord == null) throw new AssertionError();
|
||||
byte[] payload = nextRecord.getPayload();
|
||||
if (payload.length == 0) throw new FormatException();
|
||||
if (payload.length % UniqueId.LENGTH != 0) throw new FormatException();
|
||||
@@ -122,7 +122,7 @@ class SyncRecordReaderImpl implements SyncRecordReader {
|
||||
@Override
|
||||
public Message readMessage() throws IOException {
|
||||
if (!hasMessage()) throw new FormatException();
|
||||
assert nextRecord != null;
|
||||
if (nextRecord == null) throw new AssertionError();
|
||||
byte[] payload = nextRecord.getPayload();
|
||||
if (payload.length < MESSAGE_HEADER_LENGTH) throw new FormatException();
|
||||
// Validate timestamp
|
||||
|
||||
Reference in New Issue
Block a user