Skip to content

Commit

Permalink
Check result returned by inc/dec protocols is number
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 committed Jul 22, 2011
1 parent 3a71abb commit 72d7d9b
Showing 1 changed file with 12 additions and 7 deletions.
Expand Up @@ -72,9 +72,14 @@ public final boolean decode(MemcachedTCPSession session, ByteBuffer buffer) {
countDownLatch();
return true;
} else {
setResult(Long.valueOf(line.trim()));
countDownLatch();
return true;
String rt = line.trim();
if (Character.isDigit(rt.charAt(0))) {
setResult(Long.valueOf(rt));
countDownLatch();
return true;
} else {
return decodeError(line);
}
}
}
return false;
Expand All @@ -91,11 +96,11 @@ public final void encode() {
}
byte[] buf = new byte[size];
if (isNoreply()) {
ByteUtils.setArguments(buf, 0, cmdBytes, this.keyBytes, this
.getDelta(), Constants.NO_REPLY);
ByteUtils.setArguments(buf, 0, cmdBytes, this.keyBytes,
this.getDelta(), Constants.NO_REPLY);
} else {
ByteUtils.setArguments(buf, 0, cmdBytes, this.keyBytes, this
.getDelta());
ByteUtils.setArguments(buf, 0, cmdBytes, this.keyBytes,
this.getDelta());
}
this.ioBuffer = IoBuffer.wrap(buf);
}
Expand Down

0 comments on commit 72d7d9b

Please sign in to comment.