Program: 113570
Project: 113570
Buggy source:
private void assembleResponse(SelectionKey key,ServerConnection con){
  if (Logging.isDebug())   Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,"String_Node_Str");
  ONCRPCResponseHeader hdr=null;
  ReusableBuffer firstFragment=null;
  try {
    firstFragment=con.getResponseFragments().get(0);
    firstFragment.position(0);
    hdr=new ONCRPCResponseHeader();
    hdr.unmarshal(new XDRUnmarshaller(firstFragment));
  }
 catch (  Exception ex) {
    if (Logging.isDebug()) {
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,"String_Node_Str",con.getChannel().socket().getRemoteSocketAddress().toString());
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,OutputUtils.stackTraceToString(ex));
    }
    closeConnection(key,new IOException("String_Node_Str"));
    return;
  }
  final int xid=hdr.getXID();
  ONCRPCRequest rec=con.getRequest(xid);
  if (rec == null) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.net,this,"String_Node_Str",xid);
    con.clearResponseFragments();
    return;
  }
  if (ENABLE_STATISTICS) {
    rec.endT=System.nanoTime();
    con.bytesRX+=firstFragment.capacity();
  }
  rec.setResponseFragments(con.getResponseFragments());
  con.clearResponseFragments();
  final int accept_stat=hdr.getAcceptStat();
  if (accept_stat == ONCRPCResponseHeader.ACCEPT_STAT_SUCCESS) {
    rec.getListener().responseAvailable(rec);
  }
 else {
    ONCRPCException exception=null;
    if (accept_stat <= ONCRPCResponseHeader.ACCEPT_STAT_SYSTEM_ERR) {
      exception=new ONCRPCError(accept_stat);
    }
 else {
      try {
        if (accept_stat >= DIRInterface.getVersion() && (accept_stat < DIRInterface.getVersion() + 100)) {
          exception=DIRInterface.createException(accept_stat);
        }
 else         if (accept_stat >= MRCInterface.getVersion() && (accept_stat < MRCInterface.getVersion() + 100)) {
          exception=MRCInterface.createException(accept_stat);
        }
 else         if (accept_stat >= OSDInterface.getVersion() && (accept_stat < OSDInterface.getVersion() + 100)) {
          exception=OSDInterface.createException(accept_stat);
        }
 else {
          throw new Exception();
        }
      }
 catch (      Exception ex) {
        Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str",accept_stat);
        exception=new ProtocolException(ONCRPCResponseHeader.ACCEPT_STAT_SYSTEM_ERR,0,"String_Node_Str" + accept_stat);
      }
      assert(exception != null);
      try {
        exception.unmarshal(new XDRUnmarshaller(firstFragment));
      }
 catch (      Throwable ex) {
        rec.getListener().requestFailed(rec,new IOException("String_Node_Str" + ex));
        return;
      }
    }
    rec.getListener().remoteExceptionThrown(rec,exception);
  }
}

Fixed version (ground truth):
private void assembleResponse(SelectionKey key,ServerConnection con){
  if (Logging.isDebug())   Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,"String_Node_Str");
  ONCRPCResponseHeader hdr=null;
  ReusableBuffer firstFragment=null;
  try {
    firstFragment=con.getResponseFragments().get(0);
    firstFragment.position(0);
    hdr=new ONCRPCResponseHeader();
    hdr.unmarshal(new XDRUnmarshaller(firstFragment));
  }
 catch (  Exception ex) {
    if (Logging.isDebug()) {
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,"String_Node_Str",con.getChannel().socket().getRemoteSocketAddress().toString());
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,OutputUtils.stackTraceToString(ex));
    }
    closeConnection(key,new IOException("String_Node_Str"));
    return;
  }
  final int xid=hdr.getXID();
  ONCRPCRequest rec=con.getRequest(xid);
  if (rec == null) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.net,this,"String_Node_Str",xid);
    for (    ReusableBuffer frag : con.getResponseFragments()) {
      BufferPool.free(frag);
    }
    con.clearResponseFragments();
    return;
  }
  if (ENABLE_STATISTICS) {
    rec.endT=System.nanoTime();
    con.bytesRX+=firstFragment.capacity();
  }
  rec.setResponseFragments(con.getResponseFragments());
  con.clearResponseFragments();
  final int accept_stat=hdr.getAcceptStat();
  if (accept_stat == ONCRPCResponseHeader.ACCEPT_STAT_SUCCESS) {
    rec.getListener().responseAvailable(rec);
  }
 else {
    ONCRPCException exception=null;
    if (accept_stat <= ONCRPCResponseHeader.ACCEPT_STAT_SYSTEM_ERR) {
      exception=new ONCRPCError(accept_stat);
    }
 else {
      try {
        if (accept_stat >= DIRInterface.getVersion() && (accept_stat < DIRInterface.getVersion() + 100)) {
          exception=DIRInterface.createException(accept_stat);
        }
 else         if (accept_stat >= MRCInterface.getVersion() && (accept_stat < MRCInterface.getVersion() + 100)) {
          exception=MRCInterface.createException(accept_stat);
        }
 else         if (accept_stat >= OSDInterface.getVersion() && (accept_stat < OSDInterface.getVersion() + 100)) {
          exception=OSDInterface.createException(accept_stat);
        }
 else {
          throw new Exception();
        }
      }
 catch (      Exception ex) {
        Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str",accept_stat);
        exception=new ProtocolException(ONCRPCResponseHeader.ACCEPT_STAT_SYSTEM_ERR,0,"String_Node_Str" + accept_stat);
      }
      assert(exception != null);
      try {
        exception.unmarshal(new XDRUnmarshaller(firstFragment));
      }
 catch (      Throwable ex) {
        rec.getListener().requestFailed(rec,new IOException("String_Node_Str" + ex));
        return;
      }
    }
    rec.getListener().remoteExceptionThrown(rec,exception);
  }
}