[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14877221#comment-14877221
 ] 

Arshad Mohammad commented on ZOOKEEPER-2227:
--------------------------------------------

IMHO, smtk interface complexity can be avoided with proper handling at the 
server side. Here is code snippet what i am suggesting
{code}
incomingBuffer = ByteBuffer.allocate(8);
int rc = sock.read(incomingBuffer);
if (rc < 0) {
    throw new IOException("Read error");
}            
incomingBuffer.flip();
byte[] inputBytes=new byte[rc];
incomingBuffer.get(inputBytes);
String inputString=new String(inputBytes);
long traceMask = Long.parseLong(inputString.trim());
ZooTrace.setTextTraceLevel(traceMask);
{code}


> stmk four-letter word fails execution at server while reading trace mask 
> argument.
> ----------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2227
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2227
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.0
>            Reporter: Chris Nauroth
>            Assignee: Chris Nauroth
>         Attachments: ZOOKEEPER-2227.001.patch, ZOOKEEPER-2227.002.patch
>
>
> When the server handles the {{stmk}} four-letter word, it attempts to read an 
> 8-byte Java {{long}} from the request as the trace mask argument.  The read 
> fails, because the destination buffer's capacity is only 4 bytes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to