diff --git a/src/main/java/net/spy/memcached/compat/log/DefaultLogger.java b/src/main/java/net/spy/memcached/compat/log/DefaultLogger.java index c3b7c2461..b46857fbf 100644 --- a/src/main/java/net/spy/memcached/compat/log/DefaultLogger.java +++ b/src/main/java/net/spy/memcached/compat/log/DefaultLogger.java @@ -77,7 +77,7 @@ public synchronized void log(Level level, Object message, Throwable e) { || level == Level.WARN || level == Level.ERROR || level == Level.FATAL) { - System.err.printf("%s %s %s: %s\n", df.format(new Date()), level.name(), + System.err.printf("%s %s %s: %s%n", df.format(new Date()), level.name(), getName(), message); if (e != null) { e.printStackTrace(); diff --git a/src/main/java/net/spy/memcached/internal/BulkGetFuture.java b/src/main/java/net/spy/memcached/internal/BulkGetFuture.java index 0f956c3a1..85f4f3484 100644 --- a/src/main/java/net/spy/memcached/internal/BulkGetFuture.java +++ b/src/main/java/net/spy/memcached/internal/BulkGetFuture.java @@ -102,7 +102,7 @@ public Map getSome(long to, TimeUnit unit) throws InterruptedException, ExecutionException { Collection timedoutOps = new HashSet(); Map ret = internalGet(to, unit, timedoutOps); - if (timedoutOps.size() > 0) { + if (!timedoutOps.isEmpty()) { timeout = true; LoggerFactory.getLogger(getClass()).warn( new CheckedOperationTimeoutException("Operation timed out: ", @@ -122,7 +122,7 @@ public Map get(long to, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { Collection timedoutOps = new HashSet(); Map ret = internalGet(to, unit, timedoutOps); - if (timedoutOps.size() > 0) { + if (!timedoutOps.isEmpty()) { this.timeout = true; throw new CheckedOperationTimeoutException("Operation timed out.", timedoutOps); diff --git a/src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java b/src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java index 52deeb04b..c8dd1d96a 100644 --- a/src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java +++ b/src/main/java/net/spy/memcached/protocol/TCPMemcachedNodeImpl.java @@ -611,7 +611,7 @@ public final void fixupOps() { } public final void authComplete() { - if (reconnectBlocked != null && reconnectBlocked.size() > 0) { + if (reconnectBlocked != null && !reconnectBlocked.isEmpty()) { inputQueue.addAll(reconnectBlocked); } authLatch.countDown(); @@ -620,11 +620,11 @@ public final void authComplete() { public final void setupForAuth() { if (shouldAuth) { authLatch = new CountDownLatch(1); - if (inputQueue.size() > 0) { + if (!inputQueue.isEmpty()) { reconnectBlocked = new ArrayList(inputQueue.size() + 1); inputQueue.drainTo(reconnectBlocked); } - assert (inputQueue.size() == 0); + assert (inputQueue.isEmpty()); setupResend(); } else { authLatch = new CountDownLatch(0); diff --git a/src/main/java/net/spy/memcached/protocol/binary/MultiGetOperationImpl.java b/src/main/java/net/spy/memcached/protocol/binary/MultiGetOperationImpl.java index bc1f848cf..2aabef2a5 100644 --- a/src/main/java/net/spy/memcached/protocol/binary/MultiGetOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/binary/MultiGetOperationImpl.java @@ -123,7 +123,7 @@ protected void finishedPayload(byte[] pl) throws IOException { getStatusForErrorCode(errorCode, pl); if (responseOpaque == terminalOpaque) { - if (retryKeys.size() > 0) { + if (!retryKeys.isEmpty()) { transitionState(OperationState.RETRY); OperationStatus retryStatus = new OperationStatus(true, Integer.toString(retryKeys.size()), StatusCode.ERR_NOT_MY_VBUCKET); diff --git a/src/main/java/net/spy/memcached/tapmessage/ResponseMessage.java b/src/main/java/net/spy/memcached/tapmessage/ResponseMessage.java index 1cd7734c4..f4c3e1d7b 100644 --- a/src/main/java/net/spy/memcached/tapmessage/ResponseMessage.java +++ b/src/main/java/net/spy/memcached/tapmessage/ResponseMessage.java @@ -322,7 +322,7 @@ public ByteBuffer getBytes() { @Override public String toString() { - return String.format("Key: %s, Flags: %d, TTL: %d, Size: %d\nValue: %s", + return String.format("Key: %s, Flags: %d, TTL: %d, Size: %d%nValue: %s", getKey(), getItemFlags(), getTTL(), getValue().length, deserialize()); }