Program: 50176
Project: 50176
Buggy source:
@Description("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str") @PluginTarget(GraphDatabaseService.class) public Representation mrca(@Source GraphDatabaseService graphDb,@Description("String_Node_Str") @Parameter(name="String_Node_Str",optional=true) long[] nodeIds,@Description("String_Node_Str") @Parameter(name="String_Node_Str",optional=true) long[] ottIds) throws MultipleHitsException {
  if ((nodeIds == null || nodeIds.length < 1) && (ottIds == null || ottIds.length < 1)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ArrayList<Node> tips=new ArrayList<Node>();
  ArrayList<Long> invalidNodesIds=new ArrayList<Long>();
  ArrayList<Long> invalidOttIds=new ArrayList<Long>();
  ArrayList<Long> nodeIdsNotInSynth=new ArrayList<Long>();
  ArrayList<Long> ottIdsNotInSynth=new ArrayList<Long>();
  GraphExplorer ge=new GraphExplorer(graphDb);
  if (nodeIds != null && nodeIds.length > 0) {
    for (    long nodeId : nodeIds) {
      Node n=null;
      try {
        n=graphDb.getNodeById(nodeId);
      }
 catch (      NotFoundException e) {
      }
      if (n != null) {
        if (ge.nodeIsInSyntheticTree(n)) {
          tips.add(n);
        }
 else {
          nodeIdsNotInSynth.add(nodeId);
        }
      }
 else {
        invalidNodesIds.add(nodeId);
      }
    }
  }
  if (ottIds != null && ottIds.length > 0) {
    for (    long ottId : ottIds) {
      Node n=null;
      try {
        n=ge.findGraphTaxNodeByUID(String.valueOf(ottId));
      }
 catch (      TaxonNotFoundException e) {
      }
      if (n != null) {
        if (ge.nodeIsInSyntheticTree(n)) {
          tips.add(n);
        }
 else {
          ottIdsNotInSynth.add(ottId);
          tips.addAll(ge.getTaxonomyDescendantTips(n));
        }
      }
 else {
        invalidOttIds.add(ottId);
      }
    }
  }
  if (tips.size() < 1) {
    HashMap<String,Object> vals=new HashMap<String,Object>();
    vals.put("String_Node_Str","String_Node_Str");
    return OTRepresentationConverter.convert(vals);
  }
 else {
    HashMap<String,Object> vals=new HashMap<String,Object>();
    Node mrca=ge.getDraftTreeMRCAForNodes(tips,false);
    Node mrta=mrca;
    while (!mrta.hasProperty(NodeProperty.TAX_UID.propertyName)) {
      mrta=mrta.getSingleRelationship(RelType.SYNTHCHILDOF,Direction.OUTGOING).getEndNode();
    }
    vals.put("String_Node_Str",mrca.getId());
    String name="String_Node_Str";
    String unique="String_Node_Str";
    String rank="String_Node_Str";
    Long ottID=null;
    if (mrca.hasProperty(NodeProperty.TAX_UID.propertyName)) {
      name=(String)mrca.getProperty(NodeProperty.NAME.propertyName);
      unique=(String)mrca.getProperty(NodeProperty.NAME_UNIQUE.propertyName);
      rank=(String)mrca.getProperty(NodeProperty.TAX_RANK.propertyName);
      ottID=(Long)mrca.getProperty(NodeProperty.TAX_UID.propertyName);
    }
    vals.put("String_Node_Str",name);
    vals.put("String_Node_Str",unique);
    vals.put("String_Node_Str",rank);
    if (ottID != null) {
      vals.put("String_Node_Str",ottID);
    }
 else {
      vals.put("String_Node_Str","String_Node_Str");
    }
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.NAME.propertyName));
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.NAME_UNIQUE.propertyName));
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.TAX_RANK.propertyName));
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.TAX_UID.propertyName));
    vals.put("String_Node_Str",mrta.getId());
    vals.put("String_Node_Str",invalidNodesIds);
    vals.put("String_Node_Str",invalidOttIds);
    vals.put("String_Node_Str",nodeIdsNotInSynth);
    vals.put("String_Node_Str",ottIdsNotInSynth);
    ge.shutdownDB();
    return OTRepresentationConverter.convert(vals);
  }
}

Fixed version (ground truth):
@Description("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str") @PluginTarget(GraphDatabaseService.class) public Representation mrca(@Source GraphDatabaseService graphDb,@Description("String_Node_Str") @Parameter(name="String_Node_Str",optional=true) long[] nodeIds,@Description("String_Node_Str") @Parameter(name="String_Node_Str",optional=true) long[] ottIds) throws MultipleHitsException {
  if ((nodeIds == null || nodeIds.length < 1) && (ottIds == null || ottIds.length < 1)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ArrayList<Node> tips=new ArrayList<Node>();
  ArrayList<Long> invalidNodesIds=new ArrayList<Long>();
  ArrayList<Long> invalidOttIds=new ArrayList<Long>();
  ArrayList<Long> nodeIdsNotInSynth=new ArrayList<Long>();
  ArrayList<Long> ottIdsNotInSynth=new ArrayList<Long>();
  GraphExplorer ge=new GraphExplorer(graphDb);
  if (nodeIds != null && nodeIds.length > 0) {
    for (    long nodeId : nodeIds) {
      Node n=null;
      try {
        n=graphDb.getNodeById(nodeId);
      }
 catch (      NotFoundException e) {
      }
      if (n != null) {
        if (ge.nodeIsInSyntheticTree(n)) {
          tips.add(n);
        }
 else {
          nodeIdsNotInSynth.add(nodeId);
        }
      }
 else {
        invalidNodesIds.add(nodeId);
      }
    }
  }
  if (ottIds != null && ottIds.length > 0) {
    for (    long ottId : ottIds) {
      Node n=null;
      try {
        n=ge.findGraphTaxNodeByUID(String.valueOf(ottId));
      }
 catch (      TaxonNotFoundException e) {
      }
      if (n != null) {
        if (ge.nodeIsInSyntheticTree(n)) {
          tips.add(n);
        }
 else {
          ottIdsNotInSynth.add(ottId);
          tips.addAll(ge.getTaxonomyDescendantTips(n));
        }
      }
 else {
        invalidOttIds.add(ottId);
      }
    }
  }
  if (tips.size() < 1) {
    HashMap<String,Object> vals=new HashMap<String,Object>();
    vals.put("String_Node_Str","String_Node_Str");
    return OTRepresentationConverter.convert(vals);
  }
 else {
    HashMap<String,Object> vals=new HashMap<String,Object>();
    Node mrca=ge.getDraftTreeMRCAForNodes(tips,false);
    Node mrta=mrca;
    while (!mrta.hasProperty(NodeProperty.TAX_UID.propertyName)) {
      mrta=mrta.getSingleRelationship(RelType.SYNTHCHILDOF,Direction.OUTGOING).getEndNode();
    }
    vals.put("String_Node_Str",mrca.getId());
    String name="String_Node_Str";
    String unique="String_Node_Str";
    String rank="String_Node_Str";
    Long ottID=null;
    if (mrca.hasProperty(NodeProperty.TAX_UID.propertyName)) {
      name=(String)mrca.getProperty(NodeProperty.NAME.propertyName);
      unique=(String)mrca.getProperty(NodeProperty.NAME_UNIQUE.propertyName);
      rank=(String)mrca.getProperty(NodeProperty.TAX_RANK.propertyName);
      ottID=Long.valueOf((String)mrca.getProperty(NodeProperty.TAX_UID.propertyName));
    }
    vals.put("String_Node_Str",name);
    vals.put("String_Node_Str",unique);
    vals.put("String_Node_Str",rank);
    if (ottID != null) {
      vals.put("String_Node_Str",ottID);
    }
 else {
      vals.put("String_Node_Str","String_Node_Str");
    }
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.NAME.propertyName));
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.NAME_UNIQUE.propertyName));
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.TAX_RANK.propertyName));
    vals.put("String_Node_Str",mrta.getProperty(NodeProperty.TAX_UID.propertyName));
    vals.put("String_Node_Str",mrta.getId());
    vals.put("String_Node_Str",invalidNodesIds);
    vals.put("String_Node_Str",invalidOttIds);
    vals.put("String_Node_Str",nodeIdsNotInSynth);
    vals.put("String_Node_Str",ottIdsNotInSynth);
    ge.shutdownDB();
    return OTRepresentationConverter.convert(vals);
  }
}