Program: 20201
Project: 20201
Buggy source:
public static void main(String[] args) throws FileNotFoundException, IOException {
  CommandOption.setSummary(Vectors2Vectors.class,"String_Node_Str");
  CommandOption.process(Vectors2Vectors.class,args);
  if (args.length == 0) {
    CommandOption.getList(Vectors2Vectors.class).printUsage(false);
    System.exit(-1);
  }
  if (false && !inputFile.wasInvoked()) {
    System.err.println("String_Node_Str");
    System.exit(-1);
  }
  Random r=randomSeed.wasInvoked() ? new Random(randomSeed.value) : new Random();
  double t=trainingProportion.value;
  double v=validationProportion.value;
  logger.info("String_Node_Str" + t);
  logger.info("String_Node_Str" + v);
  logger.info("String_Node_Str" + (1 - v - t));
  logger.info("String_Node_Str" + pruneInfogain.value);
  logger.info("String_Node_Str" + pruneCount.value);
  InstanceList instances=InstanceList.load(inputFile.value);
  if (t == 1.0 && !(pruneInfogain.wasInvoked() || pruneCount.wasInvoked()) && !(hideTargets.wasInvoked() || revealTargets.wasInvoked())) {
    System.err.println("String_Node_Str");
    instances.save(trainingFile.value());
    System.exit(0);
  }
  if (pruneInfogain.wasInvoked() || pruneCount.wasInvoked()) {
    if (t != 1.0) {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    if (pruneCount.value > 0) {
      Instance firstInstance=instances.get(0);
      if (firstInstance.getData() instanceof FeatureSequence) {
        Alphabet oldAlphabet=instances.getDataAlphabet();
        Alphabet newAlphabet=new Alphabet();
        Noop newPipe=new Noop(newAlphabet,instances.getTargetAlphabet());
        InstanceList newInstanceList=new InstanceList(newPipe);
        int numFeatures=oldAlphabet.size();
        double[] counts=new double[numFeatures];
        for (int ii=0; ii < instances.size(); ii++) {
          Instance instance=instances.get(ii);
          FeatureSequence fs=(FeatureSequence)instance.getData();
          fs.addFeatureWeightsTo(counts);
        }
        Instance instance, newInstance;
        while (instances.size() > 0) {
          instance=instances.get(0);
          FeatureSequence fs=(FeatureSequence)instance.getData();
          fs.prune(counts,newAlphabet,pruneCount.value);
          newInstanceList.add(newPipe.instanceFrom(new Instance(fs,instance.getTarget(),instance.getName(),instance.getSource())));
          instances.remove(0);
        }
        logger.info("String_Node_Str" + oldAlphabet.size() + "String_Node_Str"+ newAlphabet.size());
        instances=newInstanceList;
      }
 else       if (firstInstance.getData() instanceof FeatureVector) {
        Alphabet alpha2=new Alphabet();
        Noop pipe2=new Noop(alpha2,instances.getTargetAlphabet());
        InstanceList instances2=new InstanceList(pipe2);
        int numFeatures=instances.getDataAlphabet().size();
        double[] counts=new double[numFeatures];
        for (int ii=0; ii < instances.size(); ii++) {
          Instance instance=instances.get(ii);
          FeatureVector fv=(FeatureVector)instance.getData();
          fv.addTo(counts);
        }
        BitSet bs=new BitSet(numFeatures);
        for (int fi=0; fi < numFeatures; fi++) {
          if (counts[fi] > pruneCount.value) {
            bs.set(fi);
          }
        }
        logger.info("String_Node_Str" + (numFeatures - bs.cardinality()) + "String_Node_Str"+ numFeatures+ "String_Node_Str"+ (bs.cardinality())+ "String_Node_Str");
        FeatureSelection fs=new FeatureSelection(instances.getDataAlphabet(),bs);
        for (int ii=0; ii < instances.size(); ii++) {
          Instance instance=instances.get(ii);
          FeatureVector fv=(FeatureVector)instance.getData();
          FeatureVector fv2=FeatureVector.newFeatureVector(fv,alpha2,fs);
          instances2.add(new Instance(fv2,instance.getTarget(),instance.getName(),instance.getSource()),instances.getInstanceWeight(ii));
          instance.unLock();
          instance.setData(null);
        }
        instances=instances2;
      }
 else {
        throw new UnsupportedOperationException("String_Node_Str" + firstInstance.getClass().getName() + "String_Node_Str");
      }
    }
    if (pruneInfogain.value > 0) {
      Alphabet alpha2=new Alphabet();
      Noop pipe2=new Noop(alpha2,instances.getTargetAlphabet());
      InstanceList instances2=new InstanceList(pipe2);
      InfoGain ig=new InfoGain(instances);
      FeatureSelection fs=new FeatureSelection(ig,pruneInfogain.value);
      for (int ii=0; ii < instances.size(); ii++) {
        Instance instance=instances.get(ii);
        FeatureVector fv=(FeatureVector)instance.getData();
        FeatureVector fv2=FeatureVector.newFeatureVector(fv,alpha2,fs);
        instance.unLock();
        instance.setData(null);
        instances2.add(pipe2.instanceFrom(new Instance(fv2,instance.getTarget(),instance.getName(),instance.getSource())),instances.getInstanceWeight(ii));
      }
      instances=instances2;
    }
    if (vectorToSequence.value) {
      Alphabet alpha=instances.getDataAlphabet();
      Noop pipe2=new Noop(alpha,instances.getTargetAlphabet());
      InstanceList instances2=new InstanceList(pipe2);
      for (int ii=0; ii < instances.size(); ii++) {
        Instance instance=instances.get(ii);
        FeatureVector fv=(FeatureVector)instance.getData();
        ArrayList seq=new ArrayList();
        for (int loc=0; loc < fv.numLocations(); loc++)         for (int count=0; count < fv.valueAtLocation(loc); count++)         seq.add(new Integer(fv.indexAtLocation(loc)));
        Collections.shuffle(seq);
        int[] indices=new int[seq.size()];
        for (int i=0; i < indices.length; i++)         indices[i]=((Integer)seq.get(i)).intValue();
        FeatureSequence fs=new FeatureSequence(alpha,indices);
        instance.unLock();
        instance.setData(null);
        instances2.add(pipe2.instanceFrom(new Instance(fs,instance.getTarget(),instance.getName(),instance.getSource())),instances.getInstanceWeight(ii));
      }
      instances=instances2;
    }
    if (outputFile.wasInvoked()) {
      writeInstanceList(instances,outputFile.value());
    }
 else     if (trainingFile.wasInvoked()) {
      writeInstanceList(instances,trainingFile.value());
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 else   if (trainingProportion.wasInvoked() || validationProportion.wasInvoked()) {
    InstanceList[] instanceLists=instances.split(r,new double[]{t,1 - t - v,v});
    if (instanceLists[0].size() > 0)     writeInstanceList(instanceLists[0],trainingFile.value());
    if (instanceLists[1].size() > 0)     writeInstanceList(instanceLists[1],testFile.value());
    if (instanceLists[2].size() > 0)     writeInstanceList(instanceLists[2],validationFile.value());
  }
 else   if (hideTargets.wasInvoked()) {
    Iterator<Instance> iter=instances.iterator();
    while (iter.hasNext()) {
      Instance instance=iter.next();
      instance.unLock();
      instance.setProperty("String_Node_Str",instance.getTarget());
      instance.setTarget(null);
      instance.lock();
    }
    writeInstanceList(instances,outputFile.value());
  }
 else   if (revealTargets.wasInvoked()) {
    Iterator<Instance> iter=instances.iterator();
    while (iter.hasNext()) {
      Instance instance=iter.next();
      instance.unLock();
      instance.setTarget(instance.getProperty("String_Node_Str"));
      instance.lock();
    }
    writeInstanceList(instances,outputFile.value());
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws FileNotFoundException, IOException {
  CommandOption.setSummary(Vectors2Vectors.class,"String_Node_Str");
  CommandOption.process(Vectors2Vectors.class,args);
  if (args.length == 0) {
    CommandOption.getList(Vectors2Vectors.class).printUsage(false);
    System.exit(-1);
  }
  if (false && !inputFile.wasInvoked()) {
    System.err.println("String_Node_Str");
    System.exit(-1);
  }
  Random r=randomSeed.wasInvoked() ? new Random(randomSeed.value) : new Random();
  double t=trainingProportion.value;
  double v=validationProportion.value;
  logger.info("String_Node_Str" + t);
  logger.info("String_Node_Str" + v);
  logger.info("String_Node_Str" + (1 - v - t));
  logger.info("String_Node_Str" + pruneInfogain.value);
  logger.info("String_Node_Str" + pruneCount.value);
  InstanceList instances=InstanceList.load(inputFile.value);
  if (t == 1.0 && !vectorToSequence.value && !(pruneInfogain.wasInvoked() || pruneCount.wasInvoked()) && !(hideTargets.wasInvoked() || revealTargets.wasInvoked())) {
    System.err.println("String_Node_Str");
    instances.save(trainingFile.value());
    System.exit(0);
  }
  if (pruneInfogain.wasInvoked() || pruneCount.wasInvoked()) {
    if (t != 1.0) {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    if (pruneCount.value > 0) {
      Instance firstInstance=instances.get(0);
      if (firstInstance.getData() instanceof FeatureSequence) {
        Alphabet oldAlphabet=instances.getDataAlphabet();
        Alphabet newAlphabet=new Alphabet();
        Noop newPipe=new Noop(newAlphabet,instances.getTargetAlphabet());
        InstanceList newInstanceList=new InstanceList(newPipe);
        int numFeatures=oldAlphabet.size();
        double[] counts=new double[numFeatures];
        for (int ii=0; ii < instances.size(); ii++) {
          Instance instance=instances.get(ii);
          FeatureSequence fs=(FeatureSequence)instance.getData();
          fs.addFeatureWeightsTo(counts);
        }
        Instance instance, newInstance;
        while (instances.size() > 0) {
          instance=instances.get(0);
          FeatureSequence fs=(FeatureSequence)instance.getData();
          fs.prune(counts,newAlphabet,pruneCount.value);
          newInstanceList.add(newPipe.instanceFrom(new Instance(fs,instance.getTarget(),instance.getName(),instance.getSource())));
          instances.remove(0);
        }
        logger.info("String_Node_Str" + oldAlphabet.size() + "String_Node_Str"+ newAlphabet.size());
        instances=newInstanceList;
      }
 else       if (firstInstance.getData() instanceof FeatureVector) {
        Alphabet alpha2=new Alphabet();
        Noop pipe2=new Noop(alpha2,instances.getTargetAlphabet());
        InstanceList instances2=new InstanceList(pipe2);
        int numFeatures=instances.getDataAlphabet().size();
        double[] counts=new double[numFeatures];
        for (int ii=0; ii < instances.size(); ii++) {
          Instance instance=instances.get(ii);
          FeatureVector fv=(FeatureVector)instance.getData();
          fv.addTo(counts);
        }
        BitSet bs=new BitSet(numFeatures);
        for (int fi=0; fi < numFeatures; fi++) {
          if (counts[fi] > pruneCount.value) {
            bs.set(fi);
          }
        }
        logger.info("String_Node_Str" + (numFeatures - bs.cardinality()) + "String_Node_Str"+ numFeatures+ "String_Node_Str"+ (bs.cardinality())+ "String_Node_Str");
        FeatureSelection fs=new FeatureSelection(instances.getDataAlphabet(),bs);
        for (int ii=0; ii < instances.size(); ii++) {
          Instance instance=instances.get(ii);
          FeatureVector fv=(FeatureVector)instance.getData();
          FeatureVector fv2=FeatureVector.newFeatureVector(fv,alpha2,fs);
          instances2.add(new Instance(fv2,instance.getTarget(),instance.getName(),instance.getSource()),instances.getInstanceWeight(ii));
          instance.unLock();
          instance.setData(null);
        }
        instances=instances2;
      }
 else {
        throw new UnsupportedOperationException("String_Node_Str" + firstInstance.getClass().getName() + "String_Node_Str");
      }
    }
    if (pruneInfogain.value > 0) {
      Alphabet alpha2=new Alphabet();
      Noop pipe2=new Noop(alpha2,instances.getTargetAlphabet());
      InstanceList instances2=new InstanceList(pipe2);
      InfoGain ig=new InfoGain(instances);
      FeatureSelection fs=new FeatureSelection(ig,pruneInfogain.value);
      for (int ii=0; ii < instances.size(); ii++) {
        Instance instance=instances.get(ii);
        FeatureVector fv=(FeatureVector)instance.getData();
        FeatureVector fv2=FeatureVector.newFeatureVector(fv,alpha2,fs);
        instance.unLock();
        instance.setData(null);
        instances2.add(pipe2.instanceFrom(new Instance(fv2,instance.getTarget(),instance.getName(),instance.getSource())),instances.getInstanceWeight(ii));
      }
      instances=instances2;
    }
    if (vectorToSequence.value) {
      System.out.println("String_Node_Str");
      Alphabet alpha=instances.getDataAlphabet();
      Noop pipe2=new Noop(alpha,instances.getTargetAlphabet());
      InstanceList instances2=new InstanceList(pipe2);
      for (int ii=0; ii < instances.size(); ii++) {
        Instance instance=instances.get(ii);
        FeatureVector fv=(FeatureVector)instance.getData();
        ArrayList seq=new ArrayList();
        for (int loc=0; loc < fv.numLocations(); loc++)         for (int count=0; count < fv.valueAtLocation(loc); count++)         seq.add(new Integer(fv.indexAtLocation(loc)));
        Collections.shuffle(seq);
        int[] indices=new int[seq.size()];
        for (int i=0; i < indices.length; i++)         indices[i]=((Integer)seq.get(i)).intValue();
        FeatureSequence fs=new FeatureSequence(alpha,indices);
        instance.unLock();
        instance.setData(null);
        instances2.add(pipe2.instanceFrom(new Instance(fs,instance.getTarget(),instance.getName(),instance.getSource())),instances.getInstanceWeight(ii));
      }
      instances=instances2;
    }
    if (outputFile.wasInvoked()) {
      writeInstanceList(instances,outputFile.value());
    }
 else     if (trainingFile.wasInvoked()) {
      writeInstanceList(instances,trainingFile.value());
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 else   if (vectorToSequence.value) {
    Alphabet alpha=instances.getDataAlphabet();
    Noop pipe2=new Noop(alpha,instances.getTargetAlphabet());
    InstanceList instances2=new InstanceList(pipe2);
    for (int ii=0; ii < instances.size(); ii++) {
      Instance instance=instances.get(ii);
      FeatureVector fv=(FeatureVector)instance.getData();
      ArrayList seq=new ArrayList();
      for (int loc=0; loc < fv.numLocations(); loc++)       for (int count=0; count < fv.valueAtLocation(loc); count++)       seq.add(new Integer(fv.indexAtLocation(loc)));
      Collections.shuffle(seq);
      int[] indices=new int[seq.size()];
      for (int i=0; i < indices.length; i++)       indices[i]=((Integer)seq.get(i)).intValue();
      FeatureSequence fs=new FeatureSequence(alpha,indices);
      instance.unLock();
      instance.setData(null);
      instances2.add(pipe2.instanceFrom(new Instance(fs,instance.getTarget(),instance.getName(),instance.getSource())),instances.getInstanceWeight(ii));
    }
    instances=instances2;
    if (outputFile.wasInvoked()) {
      writeInstanceList(instances,outputFile.value());
    }
  }
 else   if (trainingProportion.wasInvoked() || validationProportion.wasInvoked()) {
    InstanceList[] instanceLists=instances.split(r,new double[]{t,1 - t - v,v});
    if (instanceLists[0].size() > 0)     writeInstanceList(instanceLists[0],trainingFile.value());
    if (instanceLists[1].size() > 0)     writeInstanceList(instanceLists[1],testFile.value());
    if (instanceLists[2].size() > 0)     writeInstanceList(instanceLists[2],validationFile.value());
  }
 else   if (hideTargets.wasInvoked()) {
    Iterator<Instance> iter=instances.iterator();
    while (iter.hasNext()) {
      Instance instance=iter.next();
      instance.unLock();
      instance.setProperty("String_Node_Str",instance.getTarget());
      instance.setTarget(null);
      instance.lock();
    }
    if (outputFile.wasInvoked()) {
      writeInstanceList(instances,outputFile.value());
    }
  }
 else   if (revealTargets.wasInvoked()) {
    Iterator<Instance> iter=instances.iterator();
    while (iter.hasNext()) {
      Instance instance=iter.next();
      instance.unLock();
      instance.setTarget(instance.getProperty("String_Node_Str"));
      instance.lock();
    }
    if (outputFile.wasInvoked()) {
      writeInstanceList(instances,outputFile.value());
    }
  }
}