Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Improvements: empty method check, merge adjacent IF's #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/net/spy/memcached/MemcachedConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ public void handleIO() throws IOException {
* called very often under heavy workloads, so it should not perform extensive
* tasks in the same thread.</p>
*/
protected void handleWokenUpSelector() { }
protected void handleWokenUpSelector() {
throw new UnsupportedOperationException();
}

/**
* Helper method for {@link #handleIO()} to encapsulate everything that
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/spy/memcached/TapClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public Operation newOp(final MemcachedNode n,
Operation op = conn.getOpFactory().tapCustom(id, message,
new TapOperation.Callback() {
public void receivedStatus(OperationStatus status) {
throw new UnsupportedOperationException();
}
public void gotData(ResponseMessage tapMessage) {
rqueue.add(tapMessage);
Expand Down Expand Up @@ -217,6 +218,7 @@ public Operation newOp(final MemcachedNode n,
Operation op = conn.getOpFactory().tapDump(id,
new TapOperation.Callback() {
public void receivedStatus(OperationStatus status) {
throw new UnsupportedOperationException();
}
public void gotData(ResponseMessage tapMessage) {
rqueue.add(tapMessage);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/net/spy/memcached/auth/AuthThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,9 @@ public void complete() {

// Get the new status to inspect it.
priorStatus = foundStatus.get();
if (priorStatus != null) {
if (!priorStatus.isSuccess()) {
if (priorStatus != null && !priorStatus.isSuccess()) {
getLogger().warn("Authentication failed to " + node.getSocketAddress()
+ ", Status: " + priorStatus);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ public String getName() {
*/
public Throwable getThrowable(Object[] args) {
Throwable rv = null;
if (args.length > 0) {
if (args[args.length - 1] instanceof Throwable) {
if (args.length > 0 && args[args.length - 1] instanceof Throwable) {
rv = (Throwable) args[args.length - 1];
}
}
return rv;
}
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/net/spy/memcached/compat/log/SunLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,13 @@ public void log(Level level, Object message, Throwable e) {
StackTraceElement logRequestor = null;
String alclass = AbstractLogger.class.getName();
for (int i = 0; i < ste.length && logRequestor == null; i++) {
if (ste[i].getClassName().equals(alclass)) {
// Make sure there's another stack frame.
if (i + 1 < ste.length) {
logRequestor = ste[i + 1];
if (logRequestor.getClassName().equals(alclass)) {
logRequestor = null;
} // Also AbstractLogger
} // Found something that wasn't abstract logger
} // check for abstract logger
// Make sure classes are equals and there's another stack frame.
if (ste[i].getClassName().equals(alclass) && i + 1 < ste.length) {
logRequestor = ste[i + 1];
if (logRequestor.getClassName().equals(alclass)) {
logRequestor = null;
} // Also AbstractLogger
} // check for abstract logger and found something that wasn't abstract logger
}

// See if we could figure out who was doing the original logging,
Expand Down