Program: 33422
Project: 33422
Buggy source:
private void internalRun(){
  ImhotepRequest protoRequest=null;
  try {
    final InputStream is=Streams.newBufferedInputStream(socket.getInputStream());
    final OutputStream os=Streams.newBufferedOutputStream(socket.getOutputStream());
    final int ndcDepth=NDC.getDepth();
    final long requestId=requestIdCounter.incrementAndGet();
    NDC.push("String_Node_Str" + requestId);
    try {
      log.info("String_Node_Str");
      protoRequest=ImhotepProtobufShipping.readRequest(is);
      if (protoRequest.hasSessionId()) {
        NDC.push(protoRequest.getSessionId());
      }
      log.info("String_Node_Str" + protoRequest.getRequestType() + "String_Node_Str");
      final ImhotepResponse.Builder responseBuilder=ImhotepResponse.newBuilder();
      InetAddress inetAddress;
      String sessionId;
      int numStats;
      int numGroups;
      List<ShardInfo> shards;
      List<DatasetInfo> datasets;
      long totalDocFreq;
      long[] groupStats;
      ImhotepStatusDump statusDump;
      List<TermCount> topTerms;
switch (protoRequest.getRequestType()) {
case OPEN_SESSION:
        inetAddress=socket.getInetAddress();
      sessionId=service.handleOpenSession(protoRequest.getDataset(),protoRequest.getShardRequestList(),protoRequest.getUsername(),inetAddress.getHostAddress(),protoRequest.getClientVersion(),protoRequest.getMergeThreadLimit(),protoRequest.getOptimizeGroupZeroLookups(),protoRequest.getSessionId());
    NDC.push(sessionId);
  responseBuilder.setSessionId(sessionId);
sendResponse(responseBuilder.build(),os);
break;
case CLOSE_SESSION:
service.handleCloseSession(protoRequest.getSessionId());
sendResponse(responseBuilder.build(),os);
break;
case REGROUP:
numGroups=service.handleRegroup(protoRequest.getSessionId(),ImhotepDaemonMarshaller.marshal(protoRequest.getRemapRulesList()));
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case EXPLODED_REGROUP:
{
final int numRules=protoRequest.getLength();
numGroups=service.handleRegroup(protoRequest.getSessionId(),numRules,new UnmodifiableIterator<GroupRemapRule>(){
private int i=0;
@Override public boolean hasNext(){
return i < numRules;
}
@Override public GroupRemapRule next(){
try {
final GroupRemapMessage message=ImhotepProtobufShipping.readGroupRemapMessage(is);
final GroupRemapRule rule=ImhotepDaemonMarshaller.marshal(message);
i++;
return rule;
}
 catch (IOException e) {
throw Throwables.propagate(e);
}
}
}
);
sendResponse(responseBuilder.setNumGroups(numGroups).build(),os);
break;
}
case QUERY_REGROUP:
numGroups=service.handleQueryRegroup(protoRequest.getSessionId(),ImhotepDaemonMarshaller.marshal(protoRequest.getQueryRemapRule()));
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case INT_OR_REGROUP:
service.handleIntOrRegroup(protoRequest.getSessionId(),protoRequest.getField(),Longs.toArray(protoRequest.getIntTermList()),protoRequest.getTargetGroup(),protoRequest.getNegativeGroup(),protoRequest.getPositiveGroup());
sendResponse(responseBuilder.build(),os);
break;
case STRING_OR_REGROUP:
service.handleStringOrRegroup(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getStringTermList().toArray(new String[protoRequest.getStringTermCount()]),protoRequest.getTargetGroup(),protoRequest.getNegativeGroup(),protoRequest.getPositiveGroup());
sendResponse(responseBuilder.build(),os);
break;
case RANDOM_REGROUP:
service.handleRandomRegroup(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getIsIntField(),protoRequest.getSalt(),protoRequest.getP(),protoRequest.getTargetGroup(),protoRequest.getNegativeGroup(),protoRequest.getPositiveGroup());
sendResponse(responseBuilder.build(),os);
break;
case RANDOM_MULTI_REGROUP:
service.handleRandomMultiRegroup(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getIsIntField(),protoRequest.getSalt(),protoRequest.getTargetGroup(),Doubles.toArray(protoRequest.getPercentagesList()),Ints.toArray(protoRequest.getResultGroupsList()));
sendResponse(responseBuilder.build(),os);
break;
case GET_TOTAL_DOC_FREQ:
totalDocFreq=service.handleGetTotalDocFreq(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest));
responseBuilder.setTotalDocFreq(totalDocFreq);
sendResponse(responseBuilder.build(),os);
break;
case GET_GROUP_STATS:
groupStats=service.handleGetGroupStats(protoRequest.getSessionId(),protoRequest.getStat());
for (final long groupStat : groupStats) {
responseBuilder.addGroupStat(groupStat);
}
sendResponse(responseBuilder.build(),os);
break;
case GET_FTGS_ITERATOR:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleGetFTGSIterator(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os);
break;
case GET_FTGS_SPLIT:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleGetFTGSIteratorSplit(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os,protoRequest.getSplitIndex(),protoRequest.getNumSplits());
break;
case MERGE_FTGS_SPLIT:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleMergeFTGSIteratorSplit(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os,Lists.transform(protoRequest.getNodesList(),new Function<HostAndPort,InetSocketAddress>(){
public InetSocketAddress apply(final HostAndPort input){
return new InetSocketAddress(input.getHost(),input.getPort());
}
}
).toArray(new InetSocketAddress[protoRequest.getNodesCount()]),protoRequest.getSplitIndex());
break;
case GET_DOC_ITERATOR:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleGetDocIterator(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os);
break;
case PUSH_STAT:
numStats=service.handlePushStat(protoRequest.getSessionId(),protoRequest.getMetric());
responseBuilder.setNumStats(numStats);
sendResponse(responseBuilder.build(),os);
break;
case POP_STAT:
numStats=service.handlePopStat(protoRequest.getSessionId());
responseBuilder.setNumStats(numStats);
sendResponse(responseBuilder.build(),os);
break;
case GET_SHARD_LIST:
shards=service.handleGetShardList();
for (final ShardInfo shard : shards) {
responseBuilder.addShardInfo(shard.toProto());
}
sendResponse(responseBuilder.build(),os);
break;
case GET_SHARD_INFO_LIST:
datasets=service.handleGetDatasetList();
for (final DatasetInfo dataset : datasets) {
responseBuilder.addDatasetInfo(dataset.toProto());
}
sendResponse(responseBuilder.build(),os);
break;
case GET_STATUS_DUMP:
statusDump=service.handleGetStatusDump();
responseBuilder.setStatusDump(statusDump.toProto());
sendResponse(responseBuilder.build(),os);
break;
case METRIC_REGROUP:
numGroups=service.handleMetricRegroup(protoRequest.getSessionId(),protoRequest.getXStat(),protoRequest.getXMin(),protoRequest.getXMax(),protoRequest.getXIntervalSize());
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case METRIC_REGROUP_2D:
numGroups=service.handleMetricRegroup2D(protoRequest.getSessionId(),protoRequest.getXStat(),protoRequest.getXMin(),protoRequest.getXMax(),protoRequest.getXIntervalSize(),protoRequest.getYStat(),protoRequest.getYMin(),protoRequest.getYMax(),protoRequest.getYIntervalSize());
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case METRIC_FILTER:
numGroups=service.handleMetricFilter(protoRequest.getSessionId(),protoRequest.getXStat(),protoRequest.getXMin(),protoRequest.getXMax(),protoRequest.getNegate());
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case CREATE_DYNAMIC_METRIC:
service.handleCreateDynamicMetric(protoRequest.getSessionId(),protoRequest.getDynamicMetricName());
sendResponse(responseBuilder.build(),os);
break;
case UPDATE_DYNAMIC_METRIC:
service.handleUpdateDynamicMetric(protoRequest.getSessionId(),protoRequest.getDynamicMetricName(),Ints.toArray(protoRequest.getDynamicMetricDeltasList()));
sendResponse(responseBuilder.build(),os);
break;
case CONDITIONAL_UPDATE_DYNAMIC_METRIC:
service.handleConditionalUpdateDynamicMetric(protoRequest.getSessionId(),protoRequest.getDynamicMetricName(),ImhotepDaemonMarshaller.marshal(protoRequest.getConditionsList()),Ints.toArray(protoRequest.getDynamicMetricDeltasList()));
sendResponse(responseBuilder.build(),os);
break;
case OPTIMIZE_SESSION:
service.handleRebuildAndFilterIndexes(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest));
sendResponse(responseBuilder.build(),os);
break;
case RESET_GROUPS:
service.handleResetGroups(protoRequest.getSessionId());
sendResponse(responseBuilder.build(),os);
break;
case MULTISPLIT_REGROUP:
numGroups=service.handleMultisplitRegroup(protoRequest.getSessionId(),ImhotepDaemonMarshaller.marshal(protoRequest.getMultisplitRemapRuleList()),protoRequest.getErrorOnCollisions());
sendResponse(responseBuilder.setNumGroups(numGroups).build(),os);
break;
case EXPLODED_MULTISPLIT_REGROUP:
{
final int numRules=protoRequest.getLength();
numGroups=service.handleMultisplitRegroup(protoRequest.getSessionId(),numRules,new UnmodifiableIterator<GroupMultiRemapRule>(){
private int i=0;
@Override public boolean hasNext(){
return i < numRules;
}
@Override public GroupMultiRemapRule next(){
try {
final GroupMultiRemapMessage message=ImhotepProtobufShipping.readGroupMultiRemapMessage(is);
final GroupMultiRemapRule rule=ImhotepDaemonMarshaller.marshal(message);
i++;
return rule;
}
 catch (IOException e) {
throw Throwables.propagate(e);
}
}
}
,protoRequest.getErrorOnCollisions());
sendResponse(responseBuilder.setNumGroups(numGroups).build(),os);
break;
}
case APPROXIMATE_TOP_TERMS:
topTerms=service.handleApproximateTopTerms(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getIsIntField(),protoRequest.getK());
sendResponse(responseBuilder.addAllTopTerms(ImhotepDaemonMarshaller.marshal(topTerms)).build(),os);
break;
case SHUTDOWN:
if (protoRequest.hasSessionId() && "String_Node_Str".equals(protoRequest.getSessionId())) {
log.info("String_Node_Str");
close(socket,is,os);
shutdown(true);
}
break;
default :
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getRequestType());
}
}
 catch (ImhotepOutOfMemoryException e) {
expireSession(protoRequest);
sendResponse(ImhotepResponse.newBuilder().setResponseCode(ImhotepResponse.ResponseCode.OUT_OF_MEMORY).build(),os);
log.warn("String_Node_Str",e);
}
catch (IOException e) {
sendResponse(newErrorResponse(e),os);
throw e;
}
catch (RuntimeException e) {
expireSession(protoRequest);
sendResponse(newErrorResponse(e),os);
throw e;
}
 finally {
NDC.setMaxDepth(ndcDepth);
close(socket,is,os);
}
}
 catch (IOException e) {
expireSession(protoRequest);
if (e instanceof SocketException) {
log.warn("String_Node_Str",e);
}
 else {
log.error("String_Node_Str",e);
}
throw new RuntimeException(e);
}
}

Fixed version (ground truth):
private void internalRun(){
  ImhotepRequest protoRequest=null;
  try {
    final InputStream is=Streams.newBufferedInputStream(socket.getInputStream());
    final OutputStream os=Streams.newBufferedOutputStream(socket.getOutputStream());
    final int ndcDepth=NDC.getDepth();
    final long requestId=requestIdCounter.incrementAndGet();
    NDC.push("String_Node_Str" + requestId);
    try {
      log.info("String_Node_Str");
      protoRequest=ImhotepProtobufShipping.readRequest(is);
      if (protoRequest.hasSessionId()) {
        NDC.push(protoRequest.getSessionId());
      }
      log.info("String_Node_Str" + protoRequest.getRequestType() + "String_Node_Str");
      final ImhotepResponse.Builder responseBuilder=ImhotepResponse.newBuilder();
      InetAddress inetAddress;
      String sessionId;
      int numStats;
      int numGroups;
      List<ShardInfo> shards;
      List<DatasetInfo> datasets;
      long totalDocFreq;
      long[] groupStats;
      ImhotepStatusDump statusDump;
      List<TermCount> topTerms;
switch (protoRequest.getRequestType()) {
case OPEN_SESSION:
        inetAddress=socket.getInetAddress();
      sessionId=service.handleOpenSession(protoRequest.getDataset(),protoRequest.getShardRequestList(),protoRequest.getUsername(),inetAddress.getHostAddress(),protoRequest.getClientVersion(),protoRequest.getMergeThreadLimit(),protoRequest.getOptimizeGroupZeroLookups(),protoRequest.getSessionId());
    NDC.push(sessionId);
  responseBuilder.setSessionId(sessionId);
sendResponse(responseBuilder.build(),os);
break;
case CLOSE_SESSION:
service.handleCloseSession(protoRequest.getSessionId());
sendResponse(responseBuilder.build(),os);
break;
case REGROUP:
numGroups=service.handleRegroup(protoRequest.getSessionId(),ImhotepDaemonMarshaller.marshalGroupRemapMessageList(protoRequest.getRemapRulesList()));
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case EXPLODED_REGROUP:
{
final int numRules=protoRequest.getLength();
numGroups=service.handleRegroup(protoRequest.getSessionId(),numRules,new UnmodifiableIterator<GroupRemapRule>(){
private int i=0;
@Override public boolean hasNext(){
return i < numRules;
}
@Override public GroupRemapRule next(){
try {
final GroupRemapMessage message=ImhotepProtobufShipping.readGroupRemapMessage(is);
final GroupRemapRule rule=ImhotepDaemonMarshaller.marshal(message);
i++;
return rule;
}
 catch (IOException e) {
throw Throwables.propagate(e);
}
}
}
);
sendResponse(responseBuilder.setNumGroups(numGroups).build(),os);
break;
}
case QUERY_REGROUP:
numGroups=service.handleQueryRegroup(protoRequest.getSessionId(),ImhotepDaemonMarshaller.marshal(protoRequest.getQueryRemapRule()));
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case INT_OR_REGROUP:
service.handleIntOrRegroup(protoRequest.getSessionId(),protoRequest.getField(),Longs.toArray(protoRequest.getIntTermList()),protoRequest.getTargetGroup(),protoRequest.getNegativeGroup(),protoRequest.getPositiveGroup());
sendResponse(responseBuilder.build(),os);
break;
case STRING_OR_REGROUP:
service.handleStringOrRegroup(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getStringTermList().toArray(new String[protoRequest.getStringTermCount()]),protoRequest.getTargetGroup(),protoRequest.getNegativeGroup(),protoRequest.getPositiveGroup());
sendResponse(responseBuilder.build(),os);
break;
case RANDOM_REGROUP:
service.handleRandomRegroup(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getIsIntField(),protoRequest.getSalt(),protoRequest.getP(),protoRequest.getTargetGroup(),protoRequest.getNegativeGroup(),protoRequest.getPositiveGroup());
sendResponse(responseBuilder.build(),os);
break;
case RANDOM_MULTI_REGROUP:
service.handleRandomMultiRegroup(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getIsIntField(),protoRequest.getSalt(),protoRequest.getTargetGroup(),Doubles.toArray(protoRequest.getPercentagesList()),Ints.toArray(protoRequest.getResultGroupsList()));
sendResponse(responseBuilder.build(),os);
break;
case GET_TOTAL_DOC_FREQ:
totalDocFreq=service.handleGetTotalDocFreq(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest));
responseBuilder.setTotalDocFreq(totalDocFreq);
sendResponse(responseBuilder.build(),os);
break;
case GET_GROUP_STATS:
groupStats=service.handleGetGroupStats(protoRequest.getSessionId(),protoRequest.getStat());
for (final long groupStat : groupStats) {
responseBuilder.addGroupStat(groupStat);
}
sendResponse(responseBuilder.build(),os);
break;
case GET_FTGS_ITERATOR:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleGetFTGSIterator(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os);
break;
case GET_FTGS_SPLIT:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleGetFTGSIteratorSplit(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os,protoRequest.getSplitIndex(),protoRequest.getNumSplits());
break;
case MERGE_FTGS_SPLIT:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleMergeFTGSIteratorSplit(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os,Lists.transform(protoRequest.getNodesList(),new Function<HostAndPort,InetSocketAddress>(){
public InetSocketAddress apply(final HostAndPort input){
return new InetSocketAddress(input.getHost(),input.getPort());
}
}
).toArray(new InetSocketAddress[protoRequest.getNodesCount()]),protoRequest.getSplitIndex());
break;
case GET_DOC_ITERATOR:
if (!service.sessionIsValid(protoRequest.getSessionId())) {
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getSessionId());
}
sendResponse(responseBuilder.build(),os);
service.handleGetDocIterator(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest),os);
break;
case PUSH_STAT:
numStats=service.handlePushStat(protoRequest.getSessionId(),protoRequest.getMetric());
responseBuilder.setNumStats(numStats);
sendResponse(responseBuilder.build(),os);
break;
case POP_STAT:
numStats=service.handlePopStat(protoRequest.getSessionId());
responseBuilder.setNumStats(numStats);
sendResponse(responseBuilder.build(),os);
break;
case GET_SHARD_LIST:
shards=service.handleGetShardList();
for (final ShardInfo shard : shards) {
responseBuilder.addShardInfo(shard.toProto());
}
sendResponse(responseBuilder.build(),os);
break;
case GET_SHARD_INFO_LIST:
datasets=service.handleGetDatasetList();
for (final DatasetInfo dataset : datasets) {
responseBuilder.addDatasetInfo(dataset.toProto());
}
sendResponse(responseBuilder.build(),os);
break;
case GET_STATUS_DUMP:
statusDump=service.handleGetStatusDump();
responseBuilder.setStatusDump(statusDump.toProto());
sendResponse(responseBuilder.build(),os);
break;
case METRIC_REGROUP:
numGroups=service.handleMetricRegroup(protoRequest.getSessionId(),protoRequest.getXStat(),protoRequest.getXMin(),protoRequest.getXMax(),protoRequest.getXIntervalSize());
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case METRIC_REGROUP_2D:
numGroups=service.handleMetricRegroup2D(protoRequest.getSessionId(),protoRequest.getXStat(),protoRequest.getXMin(),protoRequest.getXMax(),protoRequest.getXIntervalSize(),protoRequest.getYStat(),protoRequest.getYMin(),protoRequest.getYMax(),protoRequest.getYIntervalSize());
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case METRIC_FILTER:
numGroups=service.handleMetricFilter(protoRequest.getSessionId(),protoRequest.getXStat(),protoRequest.getXMin(),protoRequest.getXMax(),protoRequest.getNegate());
responseBuilder.setNumGroups(numGroups);
sendResponse(responseBuilder.build(),os);
break;
case CREATE_DYNAMIC_METRIC:
service.handleCreateDynamicMetric(protoRequest.getSessionId(),protoRequest.getDynamicMetricName());
sendResponse(responseBuilder.build(),os);
break;
case UPDATE_DYNAMIC_METRIC:
service.handleUpdateDynamicMetric(protoRequest.getSessionId(),protoRequest.getDynamicMetricName(),Ints.toArray(protoRequest.getDynamicMetricDeltasList()));
sendResponse(responseBuilder.build(),os);
break;
case CONDITIONAL_UPDATE_DYNAMIC_METRIC:
service.handleConditionalUpdateDynamicMetric(protoRequest.getSessionId(),protoRequest.getDynamicMetricName(),ImhotepDaemonMarshaller.marshalRegroupConditionMessageList(protoRequest.getConditionsList()),Ints.toArray(protoRequest.getDynamicMetricDeltasList()));
sendResponse(responseBuilder.build(),os);
break;
case OPTIMIZE_SESSION:
service.handleRebuildAndFilterIndexes(protoRequest.getSessionId(),getIntFields(protoRequest),getStringFields(protoRequest));
sendResponse(responseBuilder.build(),os);
break;
case RESET_GROUPS:
service.handleResetGroups(protoRequest.getSessionId());
sendResponse(responseBuilder.build(),os);
break;
case MULTISPLIT_REGROUP:
numGroups=service.handleMultisplitRegroup(protoRequest.getSessionId(),ImhotepDaemonMarshaller.marshalGroupMultiRemapMessageList(protoRequest.getMultisplitRemapRuleList()),protoRequest.getErrorOnCollisions());
sendResponse(responseBuilder.setNumGroups(numGroups).build(),os);
break;
case EXPLODED_MULTISPLIT_REGROUP:
{
final int numRules=protoRequest.getLength();
numGroups=service.handleMultisplitRegroup(protoRequest.getSessionId(),numRules,new UnmodifiableIterator<GroupMultiRemapRule>(){
private int i=0;
@Override public boolean hasNext(){
return i < numRules;
}
@Override public GroupMultiRemapRule next(){
try {
final GroupMultiRemapMessage message=ImhotepProtobufShipping.readGroupMultiRemapMessage(is);
final GroupMultiRemapRule rule=ImhotepDaemonMarshaller.marshal(message);
i++;
return rule;
}
 catch (IOException e) {
throw Throwables.propagate(e);
}
}
}
,protoRequest.getErrorOnCollisions());
sendResponse(responseBuilder.setNumGroups(numGroups).build(),os);
break;
}
case APPROXIMATE_TOP_TERMS:
topTerms=service.handleApproximateTopTerms(protoRequest.getSessionId(),protoRequest.getField(),protoRequest.getIsIntField(),protoRequest.getK());
sendResponse(responseBuilder.addAllTopTerms(ImhotepDaemonMarshaller.marshalTermCountList(topTerms)).build(),os);
break;
case SHUTDOWN:
if (protoRequest.hasSessionId() && "String_Node_Str".equals(protoRequest.getSessionId())) {
log.info("String_Node_Str");
close(socket,is,os);
shutdown(true);
}
break;
default :
throw new IllegalArgumentException("String_Node_Str" + protoRequest.getRequestType());
}
}
 catch (ImhotepOutOfMemoryException e) {
expireSession(protoRequest);
sendResponse(ImhotepResponse.newBuilder().setResponseCode(ImhotepResponse.ResponseCode.OUT_OF_MEMORY).build(),os);
log.warn("String_Node_Str",e);
}
catch (IOException e) {
sendResponse(newErrorResponse(e),os);
throw e;
}
catch (RuntimeException e) {
expireSession(protoRequest);
sendResponse(newErrorResponse(e),os);
throw e;
}
 finally {
NDC.setMaxDepth(ndcDepth);
close(socket,is,os);
}
}
 catch (IOException e) {
expireSession(protoRequest);
if (e instanceof SocketException) {
log.warn("String_Node_Str",e);
}
 else {
log.error("String_Node_Str",e);
}
throw new RuntimeException(e);
}
}