}
if (pkt != null)
{
JdwpCommandPacket commandPkt = (JdwpCommandPacket) pkt;
JdwpReplyPacket reply = new JdwpReplyPacket(commandPkt);
// Reset our output stream
_outputBytes.reset();
// Create a ByteBuffer around the command packet
ByteBuffer bb = ByteBuffer.wrap(commandPkt.getData());
byte command = commandPkt.getCommand();
byte commandSet = commandPkt.getCommandSet();
CommandSet set = null;
try
{
// There is no command set with value 0
if (commandSet > 0 && commandSet < _sets.length)
{
set = _sets[commandPkt.getCommandSet()];
}
if (set != null)
{
_shutdown = set.runCommand(bb, _os, command);
reply.setData(_outputBytes.toByteArray());
}
else
{
// This command set wasn't in our tree
reply.setErrorCode(JdwpConstants.Error.NOT_IMPLEMENTED);
}
}
catch (JdwpException ex)
{
reply.setErrorCode(ex.getErrorCode ());
}
_connection.sendPacket (reply);
}
}