Program: 50034
Project: 50034
Buggy source:
public void sendAsyncQuery(RPCElement elem) throws TransportException {
  Reply reply=new Reply();
  Vector<Error> errors=new Vector<Error>();
  if (elem instanceof Hello) {
    ArrayList<Capability> capabilities=((Hello)elem).getCapabilities();
    capabilities.retainAll(this.supportedCapabilities);
    context.setActiveCapabilities(capabilities);
  }
  if (elem instanceof Query) {
    Query query=(Query)elem;
    Operation op=query.getOperation();
    if (op == Operation.COPY_CONFIG) {
    }
    if (op == Operation.DELETE_CONFIG) {
      reply.setOk(true);
    }
    if (op == Operation.EDIT_CONFIG) {
    }
    if (op.equals(Operation.GET)) {
      if (query.getFilter() != null && query.getFilterType() != null) {
        if (context.getActiveCapabilities().contains(Capability.XPATH)) {
          if (!(query.getFilterType().equals("String_Node_Str") || query.getFilterType().equals("String_Node_Str")))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
 else           if (query.getFilterType().equals("String_Node_Str"))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
        }
      }
      reply.setMessageId(query.getMessageId());
      reply.setData("String_Node_Str");
    }
    if (op == Operation.GET_CONFIG) {
      if (query.getSource() == null)       errors.add(new Error(){
{
          setTag(ErrorTag.MISSING_ELEMENT);
          setType(ErrorType.PROTOCOL);
          setSeverity(ErrorSeverity.ERROR);
          setInfo("String_Node_Str");
        }
      }
);
      if (query.getSource() == null && query.getSource().equals("String_Node_Str")) {
        errors.add(new Error(){
{
            setTag(ErrorTag.BAD_ELEMENT);
            setType(ErrorType.PROTOCOL);
            setSeverity(ErrorSeverity.ERROR);
            setInfo("String_Node_Str");
          }
        }
);
      }
      if (query.getFilter() != null && query.getFilterType() != null) {
        if (context.getActiveCapabilities().contains(Capability.XPATH)) {
          if (!(query.getFilterType().equals("String_Node_Str") || query.getFilterType().equals("String_Node_Str")))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
 else           if (query.getFilterType().equals("String_Node_Str"))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
        }
      }
      reply.setMessageId(query.getMessageId());
      reply.setData("String_Node_Str");
    }
    if (op == Operation.KILL_SESSION) {
      disconnect();
      return;
    }
    if (op == Operation.CLOSE_SESSION) {
      reply.setMessageId(query.getMessageId());
      reply.setOk(true);
      disconnect();
    }
    if (op == Operation.LOCK) {
      error("String_Node_Str");
    }
    if (op == Operation.UNLOCK) {
      error("String_Node_Str");
    }
  }
  if (subsystem.equals("String_Node_Str"))   addErrors(errors);
  if (errors.size() > 0)   reply.setErrors(errors);
  queue.put(reply);
}

Fixed version (ground truth):
public void sendAsyncQuery(RPCElement elem) throws TransportException {
  Reply reply=new Reply();
  Vector<Error> errors=new Vector<Error>();
  if (elem instanceof Hello) {
    ArrayList<Capability> capabilities=((Hello)elem).getCapabilities();
    capabilities.retainAll(this.supportedCapabilities);
    context.setActiveCapabilities(capabilities);
  }
  if (elem instanceof Query) {
    Query query=(Query)elem;
    Operation op=query.getOperation();
    if (op.equals(Operation.COPY_CONFIG)) {
    }
    if (op.equals(Operation.DELETE_CONFIG)) {
      reply.setOk(true);
    }
    if (op.equals(Operation.EDIT_CONFIG)) {
    }
    if (op.equals(Operation.GET)) {
      if (query.getFilter() != null && query.getFilterType() != null) {
        if (context.getActiveCapabilities().contains(Capability.XPATH)) {
          if (!(query.getFilterType().equals("String_Node_Str") || query.getFilterType().equals("String_Node_Str")))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
 else           if (query.getFilterType().equals("String_Node_Str"))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
        }
      }
      reply.setMessageId(query.getMessageId());
      reply.setData("String_Node_Str");
    }
    if (op.equals(Operation.GET_CONFIG)) {
      if (query.getSource() == null)       errors.add(new Error(){
{
          setTag(ErrorTag.MISSING_ELEMENT);
          setType(ErrorType.PROTOCOL);
          setSeverity(ErrorSeverity.ERROR);
          setInfo("String_Node_Str");
        }
      }
);
      if (query.getSource() == null && query.getSource().equals("String_Node_Str")) {
        errors.add(new Error(){
{
            setTag(ErrorTag.BAD_ELEMENT);
            setType(ErrorType.PROTOCOL);
            setSeverity(ErrorSeverity.ERROR);
            setInfo("String_Node_Str");
          }
        }
);
      }
      if (query.getFilter() != null && query.getFilterType() != null) {
        if (context.getActiveCapabilities().contains(Capability.XPATH)) {
          if (!(query.getFilterType().equals("String_Node_Str") || query.getFilterType().equals("String_Node_Str")))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
 else           if (query.getFilterType().equals("String_Node_Str"))           errors.add(new Error(){
{
              setTag(ErrorTag.BAD_ATTRIBUTE);
              setType(ErrorType.PROTOCOL);
              setSeverity(ErrorSeverity.ERROR);
              setInfo("String_Node_Str");
            }
          }
);
        }
      }
      reply.setMessageId(query.getMessageId());
      reply.setData("String_Node_Str");
    }
    if (op.equals(Operation.KILL_SESSION)) {
      disconnect();
      return;
    }
    if (op.equals(Operation.CLOSE_SESSION)) {
      reply.setMessageId(query.getMessageId());
      reply.setOk(true);
      disconnect();
    }
    if (op.equals(Operation.LOCK)) {
      error("String_Node_Str");
    }
    if (op.equals(Operation.UNLOCK)) {
      error("String_Node_Str");
    }
  }
  if (subsystem.equals("String_Node_Str"))   addErrors(errors);
  if (errors.size() > 0)   reply.setErrors(errors);
  queue.put(reply);
}