mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Removed unnecessary conditionals from logging statements.
Very important stuff.
This commit is contained in:
@@ -268,8 +268,7 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
StreamConnection s = socketLatch.waitForReference(timeout);
|
||||
if(s != null) return new BluetoothTransportConnection(this, s);
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while exchanging invitations");
|
||||
LOG.warning("Interrupted while exchanging invitations");
|
||||
Thread.currentThread().interrupt();
|
||||
} finally {
|
||||
// Closing the socket will terminate the listener thread
|
||||
@@ -307,8 +306,7 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
long end = now + timeout;
|
||||
while(now < end && running && !socketLatch.isSet()) {
|
||||
if(!discoverySemaphore.tryAcquire()) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Another device discovery is in progress");
|
||||
LOG.info("Another device discovery is in progress");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -319,10 +317,9 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
if(url == null) continue;
|
||||
StreamConnection s = connect(url);
|
||||
if(s == null) continue;
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Outgoing connection");
|
||||
LOG.info("Outgoing connection");
|
||||
if(!socketLatch.set(s)) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Closing redundant connection");
|
||||
LOG.info("Closing redundant connection");
|
||||
tryToClose(s);
|
||||
}
|
||||
return;
|
||||
@@ -331,8 +328,7 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
return;
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while waiting for URL");
|
||||
LOG.warning("Interrupted while waiting for URL");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
} finally {
|
||||
@@ -364,15 +360,13 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Listening for invitation connections");
|
||||
LOG.info("Listening for invitation connections");
|
||||
// Listen until a connection is received or the socket is closed
|
||||
try {
|
||||
StreamConnection s = serverSocket.acceptAndOpen();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Incoming connection");
|
||||
LOG.info("Incoming connection");
|
||||
if(!socketLatch.set(s)) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Closing redundant connection");
|
||||
LOG.info("Closing redundant connection");
|
||||
s.close();
|
||||
}
|
||||
} catch(IOException e) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.briarproject.plugins.file;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@@ -56,8 +54,7 @@ class PollingRemovableDriveMonitor implements RemovableDriveMonitor, Runnable {
|
||||
drives = newDrives;
|
||||
}
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while waiting to poll");
|
||||
LOG.warning("Interrupted while waiting to poll");
|
||||
Thread.currentThread().interrupt();
|
||||
} catch(IOException e) {
|
||||
callback.exceptionThrown(e);
|
||||
|
||||
@@ -56,7 +56,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
}
|
||||
|
||||
public boolean start() throws IOException {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting");
|
||||
LOG.info("Starting");
|
||||
try {
|
||||
stateChange.acquire();
|
||||
} catch(InterruptedException e) {
|
||||
@@ -121,7 +121,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
}
|
||||
|
||||
public void stop() throws IOException {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Stopping");
|
||||
LOG.info("Stopping");
|
||||
// Wake any threads that are waiting to connect
|
||||
synchronized(this) {
|
||||
initialised = false;
|
||||
@@ -149,8 +149,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
ReliabilityLayer reliability;
|
||||
synchronized(this) {
|
||||
if(this.reliability == null) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not hanging up - already on the hook");
|
||||
LOG.info("Not hanging up - already on the hook");
|
||||
return;
|
||||
}
|
||||
reliability = this.reliability;
|
||||
@@ -158,7 +157,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
connected = false;
|
||||
}
|
||||
reliability.stop();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Hanging up");
|
||||
LOG.info("Hanging up");
|
||||
try {
|
||||
clock.sleep(ESCAPE_SEQUENCE_GUARD_TIME);
|
||||
port.writeBytes("+++".getBytes("US-ASCII"));
|
||||
@@ -176,8 +175,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
|
||||
public boolean dial(String number) throws IOException {
|
||||
if(!stateChange.tryAcquire()) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not dialling - state change in progress");
|
||||
LOG.info("Not dialling - state change in progress");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@@ -185,19 +183,17 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
reliabilityFactory.createReliabilityLayer(this);
|
||||
synchronized(this) {
|
||||
if(!initialised) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not dialling - modem not initialised");
|
||||
LOG.info("Not dialling - modem not initialised");
|
||||
return false;
|
||||
}
|
||||
if(this.reliability != null) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not dialling - call in progress");
|
||||
LOG.info("Not dialling - call in progress");
|
||||
return false;
|
||||
}
|
||||
this.reliability = reliability;
|
||||
}
|
||||
reliability.start();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Dialling");
|
||||
LOG.info("Dialling");
|
||||
try {
|
||||
String dial = "ATDT" + number + "\r\n";
|
||||
port.writeBytes(dial.getBytes("US-ASCII"));
|
||||
@@ -276,7 +272,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
byte[] b = port.readBytes();
|
||||
if(!handleData(b)) handleText(b);
|
||||
} else if(ev.isDSR() && ev.getEventValue() == 0) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Remote end hung up");
|
||||
LOG.info("Remote end hung up");
|
||||
hangUp();
|
||||
} else {
|
||||
if(LOG.isLoggable(INFO)) {
|
||||
@@ -355,8 +351,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
|
||||
private void answer() throws IOException {
|
||||
if(!stateChange.tryAcquire()) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not answering - state change in progress");
|
||||
LOG.info("Not answering - state change in progress");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -364,19 +359,17 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
reliabilityFactory.createReliabilityLayer(this);
|
||||
synchronized(this) {
|
||||
if(!initialised) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not answering - modem not initialised");
|
||||
LOG.info("Not answering - modem not initialised");
|
||||
return;
|
||||
}
|
||||
if(this.reliability != null) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Not answering - call in progress");
|
||||
LOG.info("Not answering - call in progress");
|
||||
return;
|
||||
}
|
||||
this.reliability = reliability;
|
||||
}
|
||||
reliability.start();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Answering");
|
||||
LOG.info("Answering");
|
||||
try {
|
||||
port.writeBytes("ATA\r\n".getBytes("US-ASCII"));
|
||||
} catch(IOException e) {
|
||||
|
||||
@@ -151,14 +151,13 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
if(resetModem()) continue;
|
||||
break;
|
||||
}
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Outgoing call connected");
|
||||
LOG.info("Outgoing call connected");
|
||||
ModemTransportConnection conn = new ModemTransportConnection();
|
||||
callback.outgoingConnectionCreated(c, conn);
|
||||
try {
|
||||
conn.waitForDisposal();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while polling");
|
||||
LOG.warning("Interrupted while polling");
|
||||
Thread.currentThread().interrupt();
|
||||
break;
|
||||
}
|
||||
@@ -221,7 +220,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
}
|
||||
|
||||
public void incomingCallConnected() {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Incoming call connected");
|
||||
LOG.info("Incoming call connected");
|
||||
callback.incomingConnectionCreated(new ModemTransportConnection());
|
||||
}
|
||||
|
||||
@@ -247,7 +246,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
}
|
||||
|
||||
public void dispose(boolean exception, boolean recognised) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Call disconnected");
|
||||
LOG.info("Call disconnected");
|
||||
try {
|
||||
modem.hangUp();
|
||||
} catch(IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user