Avoid string concatenation in log statements.

This commit is contained in:
Ryan Tenney
2012-03-19 13:34:38 -04:00
parent 11c286b9b9
commit aac7af2827
4 changed files with 8 additions and 8 deletions

View File

@@ -107,7 +107,7 @@ public class StreamCopier {
log.debug("Done copying from {}", in);
doneEvent.set();
} catch (IOException ioe) {
log.error("In pipe from {} to {}: " + ioe.toString(), in, out);
log.error("In pipe from {} to {}: {}", new Object[] { in, out, ioe });
doneEvent.deliverError(ioe);
}
}
@@ -136,7 +136,7 @@ public class StreamCopier {
final double timeSeconds = (System.currentTimeMillis() - startTime) / 1000.0;
final double sizeKiB = count / 1024.0;
log.info(sizeKiB + " KiB transferred in {} seconds ({} KiB/s)", timeSeconds, (sizeKiB / timeSeconds));
log.info("{} KiB transferred in {} seconds ({} KiB/s)", new Object[] { sizeKiB, timeSeconds, (sizeKiB / timeSeconds) });
if (length != -1 && read == -1)
throw new IOException("Encountered EOF, could not transfer " + length + " bytes");
@@ -154,4 +154,4 @@ public class StreamCopier {
return count;
}
}
}

View File

@@ -57,7 +57,7 @@ public abstract class Window {
throws ConnectionException {
synchronized (lock) {
size -= dec;
log.debug("Consuming by " + dec + " down to " + size);
log.debug("Consuming by {} down to {}", dec, size);
if (size < 0)
throw new ConnectionException("Window consumed to below 0");
}

View File

@@ -44,7 +44,7 @@ public class SocketForwardingConnectListener
@Override
public void gotConnect(Channel.Forwarded chan)
throws IOException {
log.info("New connection from " + chan.getOriginatorIP() + ":" + chan.getOriginatorPort());
log.info("New connection from {}:{}", chan.getOriginatorIP(), chan.getOriginatorPort());
final Socket sock = new Socket();
sock.setSendBufferSize(chan.getLocalMaxPacketSize());
@@ -66,4 +66,4 @@ public class SocketForwardingConnectListener
SocketStreamCopyMonitor.monitor(5, TimeUnit.SECONDS, chan2soc, soc2chan, chan, sock);
}
}
}

View File

@@ -31,7 +31,7 @@ public class StatefulSFTPClient
throws IOException {
super(engine);
this.cwd = getSFTPEngine().canonicalize(".");
log.info("Start dir = " + cwd);
log.info("Start dir = {}", cwd);
}
private synchronized String cwdify(String path) {
@@ -44,7 +44,7 @@ public class StatefulSFTPClient
if (statExistence(cwd) == null) {
throw new SFTPException(cwd + ": does not exist");
}
log.info("CWD = " + cwd);
log.info("CWD = {}", cwd);
}
public synchronized List<RemoteResourceInfo> ls()