Skip to content
Open
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
63 changes: 32 additions & 31 deletions src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,37 +222,38 @@ protected void finishedPayload(byte[] pl) throws IOException {
*/
protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl)
throws IOException {
errorMsg = new byte[errPl.length];
errorMsg = errPl.clone();

StatusCode statusCode = StatusCode.fromBinaryCode(errCode);

switch (errCode) {
case SUCCESS:
return STATUS_OK;
case ERR_NOT_FOUND:
return new CASOperationStatus(false, new String(errPl),
CASResponse.NOT_FOUND, statusCode);
case ERR_EXISTS:
return new CASOperationStatus(false, new String(errPl),
CASResponse.EXISTS, statusCode);
case ERR_NOT_STORED:
return new CASOperationStatus(false, new String(errPl),
CASResponse.NOT_FOUND, statusCode);
case ERR_2BIG:
case ERR_INTERNAL:
handleError(OperationErrorType.SERVER, new String(errPl));
case ERR_INVAL:
case ERR_DELTA_BADVAL:
case ERR_NOT_MY_VBUCKET:
case ERR_UNKNOWN_COMMAND:
case ERR_NO_MEM:
case ERR_NOT_SUPPORTED:
case ERR_BUSY:
case ERR_TEMP_FAIL:
return new OperationStatus(false, new String(errPl), statusCode);
default:
return null;

if(errCode == SUCCESS) {
return STATUS_OK;
} else {
StatusCode statusCode = StatusCode.fromBinaryCode(errCode);
errorMsg = errPl.clone();

switch (errCode) {
case ERR_NOT_FOUND:
return new CASOperationStatus(false, new String(errPl),
CASResponse.NOT_FOUND, statusCode);
case ERR_EXISTS:
return new CASOperationStatus(false, new String(errPl),
CASResponse.EXISTS, statusCode);
case ERR_NOT_STORED:
return new CASOperationStatus(false, new String(errPl),
CASResponse.NOT_FOUND, statusCode);
case ERR_2BIG:
case ERR_INTERNAL:
handleError(OperationErrorType.SERVER, new String(errPl));
case ERR_INVAL:
case ERR_DELTA_BADVAL:
case ERR_NOT_MY_VBUCKET:
case ERR_UNKNOWN_COMMAND:
case ERR_NO_MEM:
case ERR_NOT_SUPPORTED:
case ERR_BUSY:
case ERR_TEMP_FAIL:
return new OperationStatus(false, new String(errPl), statusCode);
default:
return null;
}
}
}

Expand Down