Program: 31743
Project: 31743
Buggy source:
/** 
 * Main method to extract the main topics from a given text
 * @param text
 * @param topicsPerDocument
 * @return
 * @throws Exception
 */
public ArrayList<Topic> extractTopicsFromText(String text,int topicsPerDocument) throws MauiFilterException {
  if (text.length() < 5) {
    log.warn("String_Node_Str" + text.length() + "String_Node_Str");
  }
  FastVector atts=new FastVector(3);
  atts.addElement(new Attribute("String_Node_Str",(FastVector)null));
  atts.addElement(new Attribute("String_Node_Str",(FastVector)null));
  atts.addElement(new Attribute("String_Node_Str",(FastVector)null));
  Instances data=new Instances("String_Node_Str",atts,0);
  double[] newInst=new double[3];
  newInst[0]=data.attribute(0).addStringValue("String_Node_Str");
  newInst[1]=data.attribute(1).addStringValue(text);
  newInst[2]=Instance.missingValue();
  data.add(new Instance(1.0,newInst));
  extractionModel.input(data.instance(0));
  data=data.stringFreeStructure();
  Instance[] topRankedInstances=new Instance[topicsPerDocument];
  Instance inst;
  int index=0;
  while ((inst=extractionModel.output()) != null) {
    double probability=inst.value(extractionModel.getProbabilityIndex());
    if (index < topicsPerDocument) {
      if (probability > 0) {
        topRankedInstances[index]=inst;
        index++;
      }
    }
  }
  ArrayList<Topic> topics=new ArrayList<Topic>();
  for (int i=0; i < topicsPerDocument; i++) {
    if (topRankedInstances[i] != null) {
      double probability=topRankedInstances[i].value(extractionModel.getProbabilityIndex());
      String topic=topRankedInstances[i].stringValue(extractionModel.getOutputFormIndex());
      String id=vocabulary.getFormatedName(topRankedInstances[i].stringValue(0));
      topics.add(new Topic(topic,id,probability));
    }
  }
  extractionModel.batchFinished();
  return topics;
}

Fixed version (ground truth):
/** 
 * Main method to extract the main topics from a given text
 * @param text
 * @param topicsPerDocument
 * @return
 * @throws Exception
 */
public ArrayList<Topic> extractTopicsFromText(String text,int topicsPerDocument) throws MauiFilterException {
  if (text.length() < 5) {
    log.warn("String_Node_Str" + text.length() + "String_Node_Str");
  }
  FastVector atts=new FastVector(3);
  atts.addElement(new Attribute("String_Node_Str",(FastVector)null));
  atts.addElement(new Attribute("String_Node_Str",(FastVector)null));
  atts.addElement(new Attribute("String_Node_Str",(FastVector)null));
  Instances data=new Instances("String_Node_Str",atts,0);
  double[] newInst=new double[3];
  newInst[0]=data.attribute(0).addStringValue("String_Node_Str");
  newInst[1]=data.attribute(1).addStringValue(text);
  newInst[2]=Instance.missingValue();
  data.add(new Instance(1.0,newInst));
  extractionModel.input(data.instance(0));
  data=data.stringFreeStructure();
  Instance[] topRankedInstances=new Instance[topicsPerDocument];
  Instance inst;
  int index=0;
  while ((inst=extractionModel.output()) != null) {
    double probability=inst.value(extractionModel.getProbabilityIndex());
    if (index < topicsPerDocument) {
      if (probability > 0) {
        topRankedInstances[index]=inst;
        index++;
      }
    }
  }
  ArrayList<Topic> topics=new ArrayList<Topic>();
  for (int i=0; i < topicsPerDocument; i++) {
    if (topRankedInstances[i] != null) {
      double probability=topRankedInstances[i].value(extractionModel.getProbabilityIndex());
      String topic=topRankedInstances[i].stringValue(extractionModel.getOutputFormIndex());
      String id="String_Node_Str";
      if (vocabulary != null) {
        id=vocabulary.getFormatedName(topRankedInstances[i].stringValue(0));
      }
      topics.add(new Topic(topic,id,probability));
    }
  }
  extractionModel.batchFinished();
  return topics;
}