nus-yam/ex-repair huggingface dataset:
Program: 3050
Project: 3050
Buggy source:
public void run(String[] args){
  CommandLineParser parser=new GnuParser();
  options=new Options();
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  try {
    cline=parser.parse(options,args);
    String cmd=args[0];
    Command cmdObj=null;
    if (cmd.equals("String_Node_Str")) {
      printHelpMessage();
    }
 else     if (cmd.equals("String_Node_Str")) {
      cmdObj=new NetStats();
    }
 else     if (cmd.equals("String_Node_Str")) {
      cmdObj=new Evolve();
    }
 else {
      printErrorMessage("String_Node_Str" + cmd + "String_Node_Str");
    }
    if (cmdObj != null) {
      if (!cmdObj.run(cline)) {
        printErrorMessage(cmdObj.getErrorMessage());
      }
    }
  }
 catch (  ParseException e) {
    String msg=e.getMessage();
    if (msg == null) {
      msg="String_Node_Str";
    }
    printErrorMessage(msg);
  }
  System.exit(0);
}

Fixed version (ground truth):
public void run(String[] args){
  args=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  CommandLineParser parser=new GnuParser();
  options=new Options();
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str",true,"String_Node_Str");
  try {
    cline=parser.parse(options,args);
    String cmd=args[0];
    Command cmdObj=null;
    if (cmd.equals("String_Node_Str")) {
      printHelpMessage();
    }
 else     if (cmd.equals("String_Node_Str")) {
      cmdObj=new NetStats();
    }
 else     if (cmd.equals("String_Node_Str")) {
      cmdObj=new Evolve();
    }
 else {
      printErrorMessage("String_Node_Str" + cmd + "String_Node_Str");
    }
    if (cmdObj != null) {
      if (!cmdObj.run(cline)) {
        printErrorMessage(cmdObj.getErrorMessage());
      }
    }
  }
 catch (  ParseException e) {
    String msg=e.getMessage();
    if (msg == null) {
      msg="String_Node_Str";
    }
    printErrorMessage(msg);
  }
  System.exit(0);
}
Program: 3051
Project: 3051
Buggy source:
public FastGenerator(int nodeCount,int edgeCount){
  super(nodeCount,edgeCount);
  trialRatio=0.01;
  trials=(int)((nodeCount * nodeCount) * trialRatio * trialRatio);
}

Fixed version (ground truth):
public FastGenerator(int nodeCount,int edgeCount){
  super(nodeCount,edgeCount);
  trialRatio=0.1;
  trials=(int)((nodeCount * nodeCount) * trialRatio * trialRatio);
}
Program: 3054
Project: 3054
Buggy source:
public boolean run(CommandLine cline){
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  String netfile=cline.getOptionValue("String_Node_Str");
  Net net=Net.load(netfile);
  String outDir=cline.getOptionValue("String_Node_Str");
  int bins=100;
  if (cline.hasOption("String_Node_Str")) {
    bins=new Integer(cline.getOptionValue("String_Node_Str"));
  }
  int nodeCount=net.getNodeCount();
  int edgeCount=net.getEdgeCount();
  Net randomNet=RandomNet.generate(nodeCount,edgeCount);
  randomNet.save(outDir + "String_Node_Str",NetFileType.SNAP);
  DiscreteDistrib inDegrees=new DiscreteDistrib(net.inDegSeq());
  DiscreteDistrib outDegrees=new DiscreteDistrib(net.outDegSeq());
  Distrib dPageRank=new Distrib(net.prDSeq(),bins);
  Distrib uPageRank=new Distrib(net.prUSeq(),bins);
  inDegrees.write(outDir + "String_Node_Str");
  outDegrees.write(outDir + "String_Node_Str");
  dPageRank.write(outDir + "String_Node_Str");
  uPageRank.write(outDir + "String_Node_Str");
  (new TriadicProfile(randomNet)).write(outDir + "String_Node_Str");
  return true;
}

Fixed version (ground truth):
public boolean run(CommandLine cline){
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  String netfile=cline.getOptionValue("String_Node_Str");
  Net net=Net.load(netfile);
  String outDir=cline.getOptionValue("String_Node_Str");
  int bins=100;
  if (cline.hasOption("String_Node_Str")) {
    bins=new Integer(cline.getOptionValue("String_Node_Str"));
  }
  int nodeCount=net.getNodeCount();
  int edgeCount=net.getEdgeCount();
  Net randomNet=RandomNet.generate(nodeCount,edgeCount);
  randomNet.save(outDir + "String_Node_Str",NetFileType.SNAP);
  DiscreteDistrib inDegrees=new DiscreteDistrib(randomNet.inDegSeq());
  DiscreteDistrib outDegrees=new DiscreteDistrib(randomNet.outDegSeq());
  Distrib dPageRank=new Distrib(randomNet.prDSeq(),bins);
  Distrib uPageRank=new Distrib(randomNet.prUSeq(),bins);
  inDegrees.write(outDir + "String_Node_Str");
  outDegrees.write(outDir + "String_Node_Str");
  dPageRank.write(outDir + "String_Node_Str");
  uPageRank.write(outDir + "String_Node_Str");
  (new TriadicProfile(randomNet)).write(outDir + "String_Node_Str");
  return true;
}
Program: 3055
Project: 3055
Buggy source:
private void calcDistances(MetricsBag bag){
  inDegreesDist=inDegrees.emdDistance(bag.inDegrees);
  outDegreesDist=outDegrees.emdDistance(outDegrees);
  pageRanksDist=pageRanks.emdDistance(bag.pageRanks);
  triadicProfileDist=triadicProfile.emdDistance(bag.triadicProfile);
  double verySmall=0.999;
  if (inDegreesDist == 0)   inDegreesDist=verySmall;
  if (outDegreesDist == 0)   outDegreesDist=verySmall;
  if (pageRanksDist == 0)   pageRanksDist=verySmall;
  if (triadicProfileDist == 0)   triadicProfileDist=verySmall;
  distance=inDegreesDist * outDegreesDist * pageRanksDist* triadicProfileDist;
  distance=Math.pow(distance,1.0 / 4.0);
}

Fixed version (ground truth):
private void calcDistances(MetricsBag bag){
  inDegreesDist=inDegrees.emdDistance(bag.inDegrees);
  outDegreesDist=outDegrees.emdDistance(bag.outDegrees);
  pageRanksDist=pageRanks.emdDistance(bag.pageRanks);
  triadicProfileDist=triadicProfile.emdDistance(bag.triadicProfile);
  double verySmall=0.999;
  if (inDegreesDist == 0)   inDegreesDist=verySmall;
  if (outDegreesDist == 0)   outDegreesDist=verySmall;
  if (pageRanksDist == 0)   pageRanksDist=verySmall;
  if (triadicProfileDist == 0)   triadicProfileDist=verySmall;
  distance=inDegreesDist * outDegreesDist * pageRanksDist* triadicProfileDist;
  distance=Math.pow(distance,1.0 / 4.0);
}
Program: 3056
Project: 3056
Buggy source:
public Net cloneFlagged(){
  Net clonedNet=new Net();
  for (  Node node : nodes) {
    if (node.isFlag()) {
      clonedNet.addNode(node.clone());
    }
  }
  for (  Edge edge : edges) {
    Node orig=edge.getOrigin();
    Node targ=edge.getTarget();
    if (orig.isFlag() && targ.isFlag()) {
      long timestamp=edge.getTimestamp();
      Node corig=clonedNet.getNodeById(orig.getId());
      Node ctarg=clonedNet.getNodeById(targ.getId());
      clonedNet.addEdge(corig,ctarg,timestamp);
    }
  }
  return clonedNet;
}

Fixed version (ground truth):
public Net cloneFlagged(){
  Net clonedNet=new Net();
  for (  Node node : nodes) {
    if (node.getFlag()) {
      clonedNet.addNode(node.clone());
    }
  }
  for (  Edge edge : edges) {
    Node orig=edge.getOrigin();
    Node targ=edge.getTarget();
    if (orig.getFlag() && targ.getFlag()) {
      long timestamp=edge.getTimestamp();
      Node corig=clonedNet.getNodeById(orig.getId());
      Node ctarg=clonedNet.getNodeById(targ.getId());
      clonedNet.addEdge(corig,ctarg,timestamp);
    }
  }
  return clonedNet;
}
Program: 3057
Project: 3057
Buggy source:
public Node(int id){
  this.id=id;
  inDegree=0;
  outDegree=0;
  birth=-1;
  inEdges=new HashSet<Edge>();
  outEdges=new HashSet<Edge>();
}

Fixed version (ground truth):
public Node(int id){
  this.id=id;
  inDegree=0;
  outDegree=0;
  inEdges=new HashSet<Edge>();
  outEdges=new HashSet<Edge>();
}
Program: 3058
Project: 3058
Buggy source:
public static Net loadNet(String filePath){
  int dotpos=filePath.lastIndexOf("String_Node_Str");
  String ext="String_Node_Str";
  if (dotpos > 0) {
    ext=filePath.substring(dotpos + 1,filePath.length());
  }
  ext=ext.toLowerCase();
  Net net=null;
  if (ext.equals("String_Node_Str")) {
    net=(new SNAPNetFile()).load(filePath);
    return net;
  }
 else   if (ext.equals("String_Node_Str")) {
    net=(new MatrixFile()).load(filePath);
    return net;
  }
 else   if (ext.equals("String_Node_Str")) {
    net=(new GMLNetFile()).load(filePath);
    return net;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static Net loadNet(String filePath){
  int dotpos=filePath.lastIndexOf("String_Node_Str");
  String ext="String_Node_Str";
  if (dotpos > 0) {
    ext=filePath.substring(dotpos + 1,filePath.length());
  }
  ext=ext.toLowerCase();
  Net net=null;
  if (ext.equals("String_Node_Str")) {
    net=(new SNAPNetFile()).load(filePath);
    return net;
  }
 else   if (ext.equals("String_Node_Str")) {
    net=(new SNAPNetFile()).load(filePath);
    return net;
  }
 else   if (ext.equals("String_Node_Str")) {
    net=(new MatrixFile()).load(filePath);
    return net;
  }
 else   if (ext.equals("String_Node_Str")) {
    net=(new GMLNetFile()).load(filePath);
    return net;
  }
 else {
    return null;
  }
}
Program: 3059
Project: 3059
Buggy source:
static public void main(String[] args){
  Net net=Net.load("String_Node_Str");
  TriadicProfile tp=new TriadicProfile(net);
  System.out.println(net);
  long[] profile=tp.getProfile();
  for (  long p : profile)   System.out.print("String_Node_Str" + p);
  System.out.println();
}

Fixed version (ground truth):
static public void main(String[] args){
  Generator gen=new Generator(7115,103689);
  gen.initRandom();
  gen.run();
  Net net=gen.getNet();
  System.out.println("String_Node_Str");
  TriadicProfile tp=new TriadicProfile(net);
  System.out.println(net);
  long[] profile=tp.getProfile();
  for (  long p : profile)   System.out.print("String_Node_Str" + p);
  System.out.println();
}
Program: 3060
Project: 3060
Buggy source:
private void triadProfile(){
  Node[] triad=new Node[3];
  profile=new long[13];
  for (int i=0; i < 13; i++)   profile[i]=0;
  for (  Node node : net.getNodes()) {
    triad[0]=node;
    triadProfileRec(triad,0,profile);
    node.setFlag(false);
  }
}

Fixed version (ground truth):
private void triadProfile(){
  Node[] triad=new Node[3];
  profile=new long[13];
  for (int i=0; i < 13; i++) {
    profile[i]=0;
  }
  int nodeCount=0;
  for (  Node node : net.getNodes()) {
    triad[0]=node;
    triadProfileRec(triad,0,profile);
    nodeCount++;
  }
}
Program: 3061
Project: 3061
Buggy source:
private void sampleRec(Node node){
  if (sampleNodeCount >= targNodeCount) {
    return;
  }
  List<Node> candidates=new LinkedList<Node>();
  for (  Edge edge : node.getOutEdges()) {
    Node outNode=edge.getTarget();
    if (!outNode.isFlag()) {
      candidates.add(outNode);
    }
  }
  Collections.shuffle(candidates);
  int count=RandomGenerator.instance().nextGeometric(0.2);
  for (  Node c : candidates) {
    if (count <= 0) {
      break;
    }
    count--;
    c.setFlag(true);
    sampleNodeCount++;
    if (sampleNodeCount >= targNodeCount) {
      return;
    }
  }
  for (  Node c : candidates) {
    if (count <= 0) {
      break;
    }
    sampleRec(c);
  }
}

Fixed version (ground truth):
private void sampleRec(Node node){
  if (sampleNodeCount >= targNodeCount) {
    return;
  }
  List<Node> candidates=new LinkedList<Node>();
  for (  Edge edge : node.getOutEdges()) {
    Node outNode=edge.getTarget();
    if (!outNode.getFlag()) {
      candidates.add(outNode);
    }
  }
  Collections.shuffle(candidates);
  int count=RandomGenerator.instance().nextGeometric(0.2);
  for (  Node c : candidates) {
    if (count <= 0) {
      break;
    }
    count--;
    c.setFlag(true);
    sampleNodeCount++;
    if (sampleNodeCount >= targNodeCount) {
      return;
    }
  }
  for (  Node c : candidates) {
    if (count <= 0) {
      break;
    }
    sampleRec(c);
  }
}
Program: 3062
Project: 3062
Buggy source:
public Net sample(double samplePercentage){
  targNodeCount=(int)((double)origNet.getNodeCount() * samplePercentage);
  sampleNodeCount=0;
  origNet.clearFlags();
  while (sampleNodeCount < targNodeCount) {
    Node node=origNet.getRandomNode();
    if (!node.isFlag()) {
      node.setFlag(true);
      sampleNodeCount++;
      sampleRec(node);
    }
  }
  return origNet.cloneFlagged();
}

Fixed version (ground truth):
public Net sample(double samplePercentage){
  targNodeCount=(int)((double)origNet.getNodeCount() * samplePercentage);
  sampleNodeCount=0;
  origNet.clearFlags();
  while (sampleNodeCount < targNodeCount) {
    Node node=origNet.getRandomNode();
    if (!node.getFlag()) {
      node.setFlag(true);
      sampleNodeCount++;
      sampleRec(node);
    }
  }
  return origNet.cloneFlagged();
}
Program: 3063
Project: 3063
Buggy source:
@Override public boolean run(CommandLine cline){
  long maxEffort=1000 * 1000 * 50;
  int generations=999999999;
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  String netfile=cline.getOptionValue("String_Node_Str");
  String outdir=cline.getOptionValue("String_Node_Str");
  EvoDRMap2P callbacks=new EvoDRMap2P(Net.load(netfile,NetFileType.SNAP),outdir,maxEffort);
  EvoStrategy popGen=new EvoStrategy(1,1,1);
  EvoGen evo=new EvoGen(popGen,callbacks,generations);
  System.out.println("String_Node_Str" + netfile);
  System.out.println(evo.infoString());
  try {
    FileWriter fstream=new FileWriter(outdir + "String_Node_Str");
    BufferedWriter out=new BufferedWriter(fstream);
    out.write(evo.infoString());
    out.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  evo.run();
  return true;
}

Fixed version (ground truth):
@Override public boolean run(CommandLine cline){
  double maxEffort=5.00;
  int generations=999999999;
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  if (!cline.hasOption("String_Node_Str")) {
    setErrorMessage("String_Node_Str");
    return false;
  }
  String netfile=cline.getOptionValue("String_Node_Str");
  String outdir=cline.getOptionValue("String_Node_Str");
  EvoDRMap2P callbacks=new EvoDRMap2P(Net.load(netfile,NetFileType.SNAP),outdir,maxEffort);
  EvoStrategy popGen=new EvoStrategy(1,1,1);
  EvoGen evo=new EvoGen(popGen,callbacks,generations);
  System.out.println("String_Node_Str" + netfile);
  System.out.println(evo.infoString());
  try {
    FileWriter fstream=new FileWriter(outdir + "String_Node_Str");
    BufferedWriter out=new BufferedWriter(fstream);
    out.write(evo.infoString());
    out.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  evo.run();
  return true;
}
Program: 3064
Project: 3064
Buggy source:
public EvoDRMap2P(Net targNet,String outDir,long maxEffort){
  this.outDir=outDir;
  this.maxEffort=maxEffort;
  targNodeCount=targNet.getNodeCount();
  targEdgeCount=targNet.getEdgeCount();
  Net sampleNet=targNet;
  samplingRatio=1;
  DownSampler sampler=new DownSampler(targNet,5);
  while (computeEffort(sampleNet) > maxEffort) {
    sampleNet=sampler.sampleDown();
    samplingRatio=sampler.getRatio();
    System.out.println("String_Node_Str" + samplingRatio + "String_Node_Str"+ maxEffort+ "String_Node_Str"+ computeEffort(sampleNet));
  }
  effort=computeEffort(sampleNet);
  sampleNodeCount=sampleNet.getNodeCount();
  sampleEdgeCount=sampleNet.getEdgeCount();
  targDRMap=genDRMap(sampleNet);
  gen=new GPGen2P(sampleNodeCount,sampleEdgeCount);
  bestCount=0;
  genDRMap(targNet).draw(outDir + "String_Node_Str");
  genDRMap(sampleNet).draw(outDir + "String_Node_Str");
  try {
    FileWriter fwriter=new FileWriter(outDir + "String_Node_Str");
    BufferedWriter writer=new BufferedWriter(fwriter);
    writer.write("String_Node_Str");
    writer.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public EvoDRMap2P(Net targNet,String outDir,double maxEffort){
  this.outDir=outDir;
  this.maxEffort=maxEffort;
  targNodeCount=targNet.getNodeCount();
  targEdgeCount=targNet.getEdgeCount();
  Net sampleNet=targNet;
  samplingRatio=1;
  DownSampler sampler=new DownSampler(targNet,5);
  while (computeEffort(sampleNet) > maxEffort) {
    sampleNet=sampler.sampleDown();
    samplingRatio=sampler.getRatio();
    System.out.println("String_Node_Str" + samplingRatio + "String_Node_Str"+ maxEffort+ "String_Node_Str"+ computeEffort(sampleNet));
  }
  effort=computeEffort(sampleNet);
  sampleNodeCount=sampleNet.getNodeCount();
  sampleEdgeCount=sampleNet.getEdgeCount();
  targDRMap=genDRMap(sampleNet);
  gen=new GPGen2P(sampleNodeCount,sampleEdgeCount);
  bestCount=0;
  genDRMap(targNet).draw(outDir + "String_Node_Str");
  genDRMap(sampleNet).draw(outDir + "String_Node_Str");
  try {
    FileWriter fwriter=new FileWriter(outDir + "String_Node_Str");
    BufferedWriter writer=new BufferedWriter(fwriter);
    writer.write("String_Node_Str");
    writer.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 3065
Project: 3065
Buggy source:
private static long computeEffort(Net net){
  return 2 * net.getNodeCount() * net.getEdgeCount();
}

Fixed version (ground truth):
private static double computeEffort(Net net){
  return 2.0 * (((double)net.getNodeCount()) / 1000.0) * (((double)net.getEdgeCount()) / 1000.0);
}
Program: 3066
Project: 3066
Buggy source:
private void calcEndogamicNetworkConcentration(){
  endogamicNetworkConcentration=0;
  double endogamicN=endogamousPercentage;
  for (int i=0; i < m; i++) {
    double x=matrix[i][i] / endogamicN;
    endogamicNetworkConcentration+=x * x;
  }
}

Fixed version (ground truth):
private void calcEndogamicNetworkConcentration(){
  endogamicNetworkConcentration=0;
  if (endogamousPercentage == 0.0)   return;
  double endogamicN=endogamousPercentage;
  for (int i=0; i < m; i++) {
    double x=matrix[i][i] / endogamicN;
    endogamicNetworkConcentration+=x * x;
  }
}
Program: 3067
Project: 3067
Buggy source:
/** 
 * Constructor
 * @param is
 * @throws IOException
 * @throws UnsupportedAudioFileException 
 */
public Sample(InputStream is) throws IOException, UnsupportedAudioFileException {
  AudioInputStream ais=AudioSystem.getAudioInputStream(is);
  _format=ais.getFormat();
  this.nChannel=_format.getChannels();
  this.nSamplesPerSec=_format.getSampleRate();
  this.nBitsPerSample=_format.getSampleSizeInBits();
  byte[] d=new byte[(int)(ais.getFrameLength() * _format.getFrameSize())];
  ais.read(d);
  data=new SampleData(d);
  points=new ArrayList<SamplePoint>();
  int count=0;
  for (int i=0; i < d.length; i++) {
    try {
      SamplePoint point=new SamplePoint(this,i);
      points.add(point);
      count++;
    }
 catch (    ArrayIndexOutOfBoundsException e) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param is
 * @throws IOException
 * @throws UnsupportedAudioFileException 
 */
public Sample(InputStream is) throws IOException, UnsupportedAudioFileException {
  AudioInputStream ais=AudioSystem.getAudioInputStream(new BufferedInputStream(is));
  _format=ais.getFormat();
  this.nChannel=_format.getChannels();
  this.nSamplesPerSec=_format.getSampleRate();
  this.nBitsPerSample=_format.getSampleSizeInBits();
  byte[] d=new byte[(int)(ais.getFrameLength() * _format.getFrameSize())];
  ais.read(d);
  data=new SampleData(d);
  points=new ArrayList<SamplePoint>();
  int count=0;
  for (int i=0; i < d.length; i++) {
    try {
      SamplePoint point=new SamplePoint(this,i);
      points.add(point);
      count++;
    }
 catch (    ArrayIndexOutOfBoundsException e) {
      break;
    }
  }
}
Program: 3069
Project: 3069
Buggy source:
public void getPhotoStatus(HttpRequest request) throws HttpException, IOException {
  Log.d(TAG,myId + "String_Node_Str");
  if (!(request instanceof HttpEntityEnclosingRequest))   throw new RuntimeException();
  HttpEntityEnclosingRequest eyefiRequest=(HttpEntityEnclosingRequest)request;
  receiveRequestEntity(eyefiRequest);
  GetPhotoStatus photoStatus=new GetPhotoStatus();
  photoStatus.parse(eyefiRequest.getEntity().getContent());
  MacAddress mac=photoStatus.getMacAddress();
  UploadKey uploadKey=getKeyForMac(mac);
  if (uploadKey != null)   photoStatus.authenticate(uploadKey,serverNonce);
 else {
    uploadKey=context.registerUnknownMac(mac);
    if (uploadKey != null) {
      photoStatus.authenticate(uploadKey,serverNonce);
      long id=db.addNewKeyWithMac(mac,uploadKey);
      Log.d(TAG,myId + "String_Node_Str" + mac+ "String_Node_Str"+ id);
      context.registerNewCard(mac,uploadKey,id);
    }
 else {
      close();
      return;
    }
  }
  int offset=0;
  String filesignature=photoStatus.getParameter("String_Node_Str");
  long id=db.imageExists(filesignature);
  if (id != -1) {
    Log.i(TAG,myId + "String_Node_Str" + filesignature+ "String_Node_Str");
    offset=0;
  }
 else {
    Log.i(TAG,myId + "String_Node_Str" + filesignature);
    db.registerNewImage(filesignature);
  }
  GetPhotoStatusResponse gpsr=new GetPhotoStatusResponse(photoStatus,1,offset);
  sendResponseHeader(gpsr);
  sendResponseEntity(gpsr);
}

Fixed version (ground truth):
public void getPhotoStatus(HttpRequest request) throws HttpException, IOException {
  Log.d(TAG,myId + "String_Node_Str");
  if (!(request instanceof HttpEntityEnclosingRequest))   throw new RuntimeException();
  HttpEntityEnclosingRequest eyefiRequest=(HttpEntityEnclosingRequest)request;
  receiveRequestEntity(eyefiRequest);
  GetPhotoStatus photoStatus=new GetPhotoStatus();
  photoStatus.parse(eyefiRequest.getEntity().getContent());
  MacAddress mac=photoStatus.getMacAddress();
  UploadKey uploadKey=getKeyForMac(mac);
  if (uploadKey != null)   photoStatus.authenticate(uploadKey,serverNonce);
 else {
    uploadKey=context.registerUnknownMac(mac);
    if (uploadKey != null) {
      photoStatus.authenticate(uploadKey,serverNonce);
      long id=db.addNewKeyWithMac(mac,uploadKey);
      Log.d(TAG,myId + "String_Node_Str" + mac+ "String_Node_Str"+ id);
      context.registerNewCard(mac,uploadKey,id);
    }
 else {
      close();
      return;
    }
  }
  int offset=0;
  String filesignature=photoStatus.getParameter("String_Node_Str");
  long id=db.imageExists(filesignature);
  if (id != -1) {
    Log.i(TAG,myId + "String_Node_Str" + filesignature+ "String_Node_Str");
  }
 else {
    Log.i(TAG,myId + "String_Node_Str" + filesignature);
    db.registerNewImage(filesignature);
  }
  GetPhotoStatusResponse gpsr=new GetPhotoStatusResponse(photoStatus,1,offset);
  sendResponseHeader(gpsr);
  sendResponseEntity(gpsr);
}
Program: 3070
Project: 3070
Buggy source:
protected int readChunk(int requested) throws IOException {
  if (isEof)   return -1;
  if (requested > maxRead)   requested=maxRead;
  in.mark(requested);
  int read=in.read(buf,0,requested);
  if (read == -1) {
    isEof=true;
    return -1;
  }
  if (read >= boundaryLength) {
    int boundaryPosition=match.indexOf(buf,0,read);
    if (boundaryPosition >= 0) {
      in.reset();
      read=in.read(buf,0,boundaryPosition + boundaryLength);
      isEof=true;
      return boundaryPosition > 0 ? boundaryPosition : -1;
    }
  }
  in.mark(boundaryLength);
  int additionalRead=in.read(buf,read,boundaryLength - 1);
  if (additionalRead == -1) {
    isEof=true;
    return read;
  }
  if ((read + additionalRead) < boundaryLength) {
    in.reset();
    return read;
  }
  int additionalStart=read - boundaryLength + 1;
  if (additionalStart < 0)   additionalStart=0;
  int boundaryPosition=match.indexOf(buf,additionalStart,read + additionalRead - additionalStart);
  if (boundaryPosition >= 0) {
    in.reset();
    read=in.read(buf,read,boundaryPosition + boundaryLength - read);
    isEof=true;
    return boundaryPosition > 0 ? boundaryPosition : -1;
  }
  in.reset();
  return read;
}

Fixed version (ground truth):
protected int readChunk(int requested) throws IOException {
  if (isEof)   return -1;
  if (requested > maxRead)   requested=maxRead;
  in.mark(requested);
  int read=in.read(buf,0,requested);
  if (read == -1) {
    isEof=true;
    return -1;
  }
  if (read >= boundaryLength) {
    int boundaryPosition=match.indexOf(buf,0,read);
    if (boundaryPosition >= 0) {
      in.reset();
      read=in.read(buf,0,boundaryPosition + boundaryLength);
      isEof=true;
      return boundaryPosition > 0 ? boundaryPosition : -1;
    }
  }
  in.mark(boundaryLength);
  int additionalRead=in.read(buf,read,boundaryLength - 1);
  if (additionalRead == -1) {
    isEof=true;
    return read;
  }
  if ((read + additionalRead) < boundaryLength) {
    in.reset();
    return read;
  }
  int additionalStart=read - boundaryLength + 1;
  if (additionalStart < 0)   additionalStart=0;
  int boundaryPosition=match.indexOf(buf,additionalStart,read + additionalRead);
  if (boundaryPosition >= 0) {
    in.reset();
    read=in.read(buf,read,boundaryPosition + boundaryLength - read);
    isEof=true;
    return boundaryPosition > 0 ? boundaryPosition : -1;
  }
  in.reset();
  return read;
}
Program: 3072
Project: 3072
Buggy source:
protected DBAdapter(Context c){
  super(c,"String_Node_Str",null,3);
  context=c;
}

Fixed version (ground truth):
protected DBAdapter(Context c){
  super(c,"String_Node_Str",null,sqlSetup.length);
  context=c;
}
Program: 3073
Project: 3073
Buggy source:
/** 
 * A contact has accepted our subscription request
 */
@Override public void contactAcceptedReceived(SessionFriendAcceptedEvent event){
  final Set<String> groups=new HashSet<String>();
  groups.add(event.getGroupName());
  final YahooUser user=new YahooUser(event.getFrom(),YahooSession.DEFAULT_GROUPNAME);
  final YahooBuddy buddy=new YahooBuddy(getSession().getBuddyManager(),user,null,groups,null);
  getSession().getBuddyManager().storeBuddy(buddy);
  final Presence p=new Presence(Presence.Type.subscribed);
  p.setTo(getSession().getJID());
  p.setFrom(getSession().getTransport().convertIDToJID(event.getFrom()));
  getSession().getTransport().sendPacket(p);
}

Fixed version (ground truth):
/** 
 * A contact has accepted our subscription request
 */
@Override public void contactAcceptedReceived(SessionFriendAcceptedEvent event){
  final Set<String> groups=new HashSet<String>();
  groups.add(event.getGroupName());
  final YahooUser user=new YahooUser(event.getFrom());
  final YahooBuddy buddy=new YahooBuddy(getSession().getBuddyManager(),user,null,groups,null);
  getSession().getBuddyManager().storeBuddy(buddy);
  final Presence p=new Presence(Presence.Type.subscribed);
  p.setTo(getSession().getJID());
  p.setFrom(getSession().getTransport().convertIDToJID(event.getFrom()));
  getSession().getTransport().sendPacket(p);
}
Program: 3074
Project: 3074
Buggy source:
/** 
 * @see net.sf.kraken.session.TransportSession#acceptAddContact(JID)
 */
@Override public void acceptAddContact(JID jid){
  final String userID=getTransport().convertJIDToID(jid);
  Log.debug("String_Node_Str" + userID);
  try {
    yahooSession.acceptFriendAuthorization(userID);
  }
 catch (  IOException e) {
    Log.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @see net.sf.kraken.session.TransportSession#acceptAddContact(JID)
 */
@Override public void acceptAddContact(JID jid){
  final String userID=getTransport().convertJIDToID(jid);
  Log.debug("String_Node_Str" + userID);
  try {
    yahooSession.acceptFriendAuthorization(userID,YahooProtocol.YAHOO);
  }
 catch (  IOException e) {
    Log.debug("String_Node_Str");
  }
}
Program: 3075
Project: 3075
Buggy source:
/** 
 * Sets up a presence packet according to a presenceType setting.
 * @param packet packet to set up.
 * @param presenceType presence type to set up.
 */
public void setUpPresencePacket(Presence packet,PresenceType presenceType){
  if (presenceType.equals(PresenceType.away)) {
    packet.setShow(Presence.Show.away);
  }
 else   if (presenceType.equals(PresenceType.xa)) {
    packet.setShow(Presence.Show.xa);
  }
 else   if (presenceType.equals(PresenceType.dnd)) {
    packet.setShow(Presence.Show.dnd);
  }
 else   if (presenceType.equals(PresenceType.chat)) {
    packet.setShow(Presence.Show.chat);
  }
 else   if (presenceType.equals(PresenceType.unavailable)) {
    packet.setType(Presence.Type.unavailable);
  }
}

Fixed version (ground truth):
/** 
 * Sets up a presence packet according to a presenceType setting.
 * @param packet packet to set up.
 * @param presenceType presence type to set up.
 */
public void setUpPresencePacket(Presence packet,PresenceType presenceType){
  if (presenceType.equals(PresenceType.away)) {
    packet.setShow(Presence.Show.away);
  }
 else   if (presenceType.equals(PresenceType.xa)) {
    packet.setShow(Presence.Show.xa);
  }
 else   if (presenceType.equals(PresenceType.dnd)) {
    packet.setShow(Presence.Show.dnd);
  }
 else   if (presenceType.equals(PresenceType.chat)) {
    packet.setShow(Presence.Show.chat);
  }
 else   if (presenceType.equals(PresenceType.unavailable)) {
    packet.setType(Presence.Type.unavailable);
  }
 else   if (presenceType.equals(PresenceType.unknown)) {
    packet.setType(Presence.Type.unavailable);
  }
}
Program: 3077
Project: 3077
Buggy source:
/** 
 * Converts an XMPP/Smack status to a Gateway status.
 * @param type Smack presence type.
 * @param mode Smack presence mode (show).
 * @return Gateway status.
 */
public PresenceType convertXMPPStatusToGateway(org.jivesoftware.smack.packet.Presence.Type type,org.jivesoftware.smack.packet.Presence.Mode mode){
  if (mode == Presence.Mode.away) {
    return PresenceType.away;
  }
 else   if (mode == Presence.Mode.dnd) {
    return PresenceType.dnd;
  }
 else   if (mode == Presence.Mode.xa) {
    return PresenceType.xa;
  }
 else   if (mode == Presence.Mode.chat) {
    return PresenceType.chat;
  }
 else   if (type == Presence.Type.unavailable) {
    return PresenceType.unavailable;
  }
 else {
    return PresenceType.available;
  }
}

Fixed version (ground truth):
/** 
 * Converts an XMPP/Smack status to a Gateway status.
 * @param type Smack presence type.
 * @param mode Smack presence mode (show).
 * @return Gateway status.
 */
public PresenceType convertXMPPStatusToGateway(org.jivesoftware.smack.packet.Presence.Type type,org.jivesoftware.smack.packet.Presence.Mode mode){
  if (mode == Presence.Mode.away) {
    return PresenceType.away;
  }
 else   if (mode == Presence.Mode.dnd) {
    return PresenceType.dnd;
  }
 else   if (mode == Presence.Mode.xa) {
    return PresenceType.xa;
  }
 else   if (mode == Presence.Mode.chat) {
    return PresenceType.chat;
  }
 else   if (type == Presence.Type.unavailable) {
    return PresenceType.unavailable;
  }
 else   if (type == Presence.Type.error) {
    return PresenceType.unavailable;
  }
 else {
    return PresenceType.available;
  }
}
Program: 3078
Project: 3078
Buggy source:
public void start(){
  super.start();
  mucTransport=new IRCMUCTransport(this);
  try {
    componentManager.addComponent("String_Node_Str",mucTransport);
  }
 catch (  Exception e) {
    componentManager.getLog().error(e);
  }
}

Fixed version (ground truth):
public void start(){
  super.start();
  mucTransport=new IRCMUCTransport(this);
  try {
    componentManager.addComponent("String_Node_Str",mucTransport);
  }
 catch (  Exception e) {
    Log.error("String_Node_Str",e);
  }
}
Program: 3079
Project: 3079
Buggy source:
public void shutdown(){
  mucTransport.shutdown();
  try {
    componentManager.removeComponent("String_Node_Str");
  }
 catch (  Exception e) {
    componentManager.getLog().error(e);
  }
  super.shutdown();
}

Fixed version (ground truth):
public void shutdown(){
  mucTransport.shutdown();
  try {
    componentManager.removeComponent("String_Node_Str");
  }
 catch (  Exception e) {
    Log.error("String_Node_Str",e);
  }
  super.shutdown();
}
Program: 3080
Project: 3080
Buggy source:
/** 
 * Stops the transport instance if it's running.
 */
public void stopInstance(){
  if (!running) {
    return;
  }
  Log.info("String_Node_Str" + type.toString());
  transport.shutdown();
  PropertyEventDispatcher.removeListener(this);
  try {
    componentManager.removeComponent(this.subDomain);
  }
 catch (  Exception e) {
    componentManager.getLog().error(e);
  }
  transport=null;
  running=false;
}

Fixed version (ground truth):
/** 
 * Stops the transport instance if it's running.
 */
public void stopInstance(){
  if (!running) {
    return;
  }
  Log.info("String_Node_Str" + type.toString());
  transport.shutdown();
  PropertyEventDispatcher.removeListener(this);
  try {
    componentManager.removeComponent(this.subDomain);
  }
 catch (  Exception e) {
    Log.error("String_Node_Str" + this.subDomain + "String_Node_Str",e);
  }
  transport=null;
  running=false;
}
Program: 3081
Project: 3081
Buggy source:
/** 
 * Starts the transport instance if it's enabled and not already running.
 */
public void startInstance(){
  if (!enabled || running) {
    return;
  }
  Log.info("String_Node_Str" + type.toString());
  transport=null;
  try {
    transport=(BaseTransport)Class.forName(nameOfClass).newInstance();
    transport.setup(this.type,this.description,sessionRouter);
  }
 catch (  ClassNotFoundException e) {
    Log.error("String_Node_Str" + nameOfClass);
    return;
  }
catch (  InstantiationException e) {
    Log.error("String_Node_Str" + nameOfClass);
    return;
  }
catch (  IllegalAccessException e) {
    Log.error("String_Node_Str" + nameOfClass);
    return;
  }
  SessionManager sessionManager=SessionManager.getInstance();
  String fullJID=this.subDomain + "String_Node_Str" + XMPPServer.getInstance().getServerInfo().getXMPPDomain();
  Boolean pause=false;
  try {
    for (    Session sess : sessionManager.getIncomingServerSessions(fullJID)) {
      sess.close();
      pause=true;
    }
  }
 catch (  Exception ignored) {
  }
  try {
    Session sess=sessionManager.getOutgoingServerSession(fullJID);
    if (sess != null) {
      sess.close();
      pause=true;
    }
  }
 catch (  Exception ignored) {
  }
  try {
    if (pause) {
      Thread.sleep(1000L);
    }
  }
 catch (  Exception ignored) {
  }
  try {
    componentManager.addComponent(this.subDomain,transport);
    PropertyEventDispatcher.addListener(this);
    running=true;
  }
 catch (  Exception e) {
    componentManager.getLog().error(e);
  }
}

Fixed version (ground truth):
/** 
 * Starts the transport instance if it's enabled and not already running.
 */
public void startInstance(){
  if (!enabled || running) {
    return;
  }
  Log.info("String_Node_Str" + type.toString());
  transport=null;
  try {
    transport=(BaseTransport)Class.forName(nameOfClass).newInstance();
    transport.setup(this.type,this.description,sessionRouter);
  }
 catch (  ClassNotFoundException e) {
    Log.error("String_Node_Str" + nameOfClass);
    return;
  }
catch (  InstantiationException e) {
    Log.error("String_Node_Str" + nameOfClass);
    return;
  }
catch (  IllegalAccessException e) {
    Log.error("String_Node_Str" + nameOfClass);
    return;
  }
  SessionManager sessionManager=SessionManager.getInstance();
  String fullJID=this.subDomain + "String_Node_Str" + XMPPServer.getInstance().getServerInfo().getXMPPDomain();
  Boolean pause=false;
  try {
    for (    Session sess : sessionManager.getIncomingServerSessions(fullJID)) {
      sess.close();
      pause=true;
    }
  }
 catch (  Exception ignored) {
  }
  try {
    Session sess=sessionManager.getOutgoingServerSession(fullJID);
    if (sess != null) {
      sess.close();
      pause=true;
    }
  }
 catch (  Exception ignored) {
  }
  try {
    if (pause) {
      Thread.sleep(1000L);
    }
  }
 catch (  Exception ignored) {
  }
  try {
    componentManager.addComponent(this.subDomain,transport);
    PropertyEventDispatcher.addListener(this);
    running=true;
  }
 catch (  Exception e) {
    Log.error("String_Node_Str" + this.subDomain + "String_Node_Str",e);
  }
}
Program: 3082
Project: 3082
Buggy source:
private void init(){
  setLayout(new BorderLayout(0,5));
  setBorder(makeBorder());
  add(makeTitlePanel(),BorderLayout.NORTH);
  VerticalPanel mainPanel=new VerticalPanel();
  mainPanel.add(createJPOSPanel());
  tcpDefaultPanel=new TCPConfigGui(false);
  JPanel mainpanel2=(JPanel)tcpDefaultPanel.getComponent(tcpDefaultPanel.getComponentCount() - 1);
  Box box=(Box)mainpanel2.getComponent(mainpanel2.getComponentCount() - 1);
  JPanel reqDataPanel=(JPanel)box.getComponent(10);
  reqDataPanel.setVisible(false);
  mainPanel.add(tcpDefaultPanel);
  add(mainPanel,BorderLayout.CENTER);
}

Fixed version (ground truth):
private void init(){
  setLayout(new BorderLayout(0,5));
  setBorder(makeBorder());
  add(makeTitlePanel(),BorderLayout.NORTH);
  VerticalPanel mainPanel=new VerticalPanel();
  mainPanel.add(createJPOSPanel());
  tcpDefaultPanel=new TCPConfigGui(false);
  add(mainPanel,BorderLayout.CENTER);
}
Program: 3083
Project: 3083
Buggy source:
/** 
 * Respond to "Start" button by requesting activity recognition updates.
 * @param view The view that triggered this method.
 */
public void onStartUpdates(View view){
  if (!servicesConnected()) {
    return;
  }
  mRunning=false;
  mRequestType=ActivityUtils.REQUEST_TYPE.ADD;
  mActivityDetectionRequester.requestUpdates(getIntervalMillis());
  ((TextView)view).setText(R.string.stop_updates);
}

Fixed version (ground truth):
/** 
 * Respond to "Start" button by requesting activity recognition updates.
 * @param view The view that triggered this method.
 */
public void onStartUpdates(View view){
  if (!servicesConnected()) {
    return;
  }
  mRunning=true;
  mRequestType=ActivityUtils.REQUEST_TYPE.ADD;
  mActivityDetectionRequester.requestUpdates(getIntervalMillis());
  ((TextView)view).setText(R.string.stop_updates);
}
Program: 3084
Project: 3084
Buggy source:
/** 
 * Respond to "Stop" button by canceling updates.
 * @param view The view that triggered this method.
 */
public void onStopUpdates(View view){
  if (!servicesConnected()) {
    return;
  }
  mRunning=true;
  mRequestType=ActivityUtils.REQUEST_TYPE.REMOVE;
  mActivityDetectionRemover.removeUpdates(mActivityDetectionRequester.getRequestPendingIntent());
  mActivityDetectionRequester.getRequestPendingIntent().cancel();
  ((TextView)view).setText(R.string.start_updates);
}

Fixed version (ground truth):
/** 
 * Respond to "Stop" button by canceling updates.
 * @param view The view that triggered this method.
 */
public void onStopUpdates(View view){
  if (!servicesConnected()) {
    return;
  }
  mRunning=false;
  mRequestType=ActivityUtils.REQUEST_TYPE.REMOVE;
  mActivityDetectionRemover.removeUpdates(mActivityDetectionRequester.getRequestPendingIntent());
  mActivityDetectionRequester.getRequestPendingIntent().cancel();
  ((TextView)view).setText(R.string.start_updates);
}
Program: 3085
Project: 3085
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  self=this;
  LogProbe.setLevel(true,Loglevel.VERBOSE);
  LogProbe.get(this);
  probeWriter=new MobilityProbeWriter(this);
  probeWriter.connect();
  SharedPreferences settings=getSharedPreferences(Mobility.MOBILITY,Context.MODE_PRIVATE);
  if (settings.getBoolean(MobilityControl.MOBILITY_ON,false)) {
    Mobility.start(this);
  }
  if (settings.getBoolean("String_Node_Str",true)) {
    settings.edit().putBoolean("String_Node_Str",true).commit();
    aggregateRead();
  }
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  self=this;
  ensureLogProbe(this);
  probeWriter=new MobilityProbeWriter(this);
  probeWriter.connect();
  SharedPreferences settings=getSharedPreferences(Mobility.MOBILITY,Context.MODE_PRIVATE);
  if (settings.getBoolean(MobilityControl.MOBILITY_ON,false)) {
    Mobility.start(this);
  }
  if (settings.getBoolean("String_Node_Str",true)) {
    settings.edit().putBoolean("String_Node_Str",true).commit();
    aggregateRead();
  }
}
Program: 3086
Project: 3086
Buggy source:
@Override public boolean onCreate(){
  dbHelper=new DatabaseHelper(getContext());
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreate(){
  dbHelper=new DatabaseHelper(getContext());
  MobilityApplication.ensureLogProbe(getContext());
  return true;
}
Program: 3087
Project: 3087
Buggy source:
/** 
 * Connects to the database, gets the information requested based on the parameters, closes the connection to the database, and returns the Cursor object that the query generated.
 * @param columns A String array representing the columns that are being requested.
 * @param selection A SQLite WHERE clause without the "WHERE" keyword.
 * @param selectionArgs A String array used for replacing "?"s in the 'selection' String with values. The number of items in the array should be equal to the number of "?"s in the 'selection' String. 'null' is an acceptable value if there are no "?"s in the 'selection' String.
 * @param orderBy A SQLite "ORDER BY" clause without the "ORDER BY" keyword.
 * @return A Cursor object pointing to all the elements that satisfy the theparameters. If a SQLite exception occurs, null is returned.
 */
public synchronized Cursor getMobilityCursor(String[] columns,String selection,String[] selectionArgs,String orderBy){
  Cursor c;
  try {
    c=getReadableDatabase().query("String_Node_Str",columns,selection,selectionArgs,null,null,orderBy);
    c.setNotificationUri(mContext.getContentResolver(),MobilityInterface.CONTENT_URI);
  }
 catch (  SQLiteException e) {
    Log.e(TAG,"String_Node_Str",e);
    c=null;
  }
  return c;
}

Fixed version (ground truth):
/** 
 * Connects to the database, gets the information requested based on the parameters, closes the connection to the database, and returns the Cursor object that the query generated.
 * @param columns A String array representing the columns that are being requested.
 * @param selection A SQLite WHERE clause without the "WHERE" keyword.
 * @param selectionArgs A String array used for replacing "?"s in the 'selection' String with values. The number of items in the array should be equal to the number of "?"s in the 'selection' String. 'null' is an acceptable value if there are no "?"s in the 'selection' String.
 * @param orderBy A SQLite "ORDER BY" clause without the "ORDER BY" keyword.
 * @return A Cursor object pointing to all the elements that satisfy the theparameters. If a SQLite exception occurs, null is returned.
 */
public Cursor getMobilityCursor(String[] columns,String selection,String[] selectionArgs,String orderBy){
  Cursor c;
  try {
    c=getReadableDatabase().query("String_Node_Str",columns,selection,selectionArgs,null,null,orderBy);
    c.setNotificationUri(mContext.getContentResolver(),MobilityInterface.CONTENT_URI);
  }
 catch (  SQLiteException e) {
    Log.e(TAG,"String_Node_Str",e);
    c=null;
  }
  return c;
}
Program: 3088
Project: 3088
Buggy source:
private void writeWifi(SharedPreferences settings,long time,String mode,Vector<String> APs,HashMap<Long,Vector<String>> lastAPs){
  String store=time + "String_Node_Str" + mode+ "String_Node_Str"+ time+ "String_Node_Str";
  for (  String s : APs)   store+=s + "String_Node_Str";
  if (APs.size() > 0) {
    if (!store.endsWith("String_Node_Str"))     Log.e(TAG,"String_Node_Str" + store + "String_Node_Str"+ APs.size());
 else     store=store.substring(0,store.length() - 1);
  }
  long now=System.currentTimeMillis();
  if (lastAPs != null) {
    for (    Long ts : lastAPs.keySet()) {
      if (ts > now - checkLength) {
        store+="String_Node_Str" + ts + "String_Node_Str";
        for (        String ap : lastAPs.get(ts))         store+=ap + "String_Node_Str";
      }
      if (!store.endsWith("String_Node_Str"))       Log.e(TAG,"String_Node_Str" + store + "String_Node_Str"+ APs.size());
 else       store=store.substring(0,store.length() - 1);
    }
  }
  Editor editor=settings.edit();
  editor.putString(WIFI_HISTORY,store);
  editor.commit();
}

Fixed version (ground truth):
private void writeWifi(SharedPreferences settings,long time,String mode,Vector<String> APs,HashMap<Long,Vector<String>> lastAPs){
  StringBuilder store=new StringBuilder(time + "String_Node_Str" + mode+ "String_Node_Str"+ time);
  for (  String s : APs)   store.append("String_Node_Str").append(s);
  long now=System.currentTimeMillis();
  if (lastAPs != null) {
    for (    Long ts : lastAPs.keySet()) {
      if (ts > now - checkLength) {
        store.append("String_Node_Str").append(ts);
        for (        String ap : lastAPs.get(ts))         store.append("String_Node_Str").append(ap);
      }
    }
  }
  Editor editor=settings.edit();
  editor.putString(WIFI_HISTORY,store.toString());
  editor.commit();
}
Program: 3090
Project: 3090
Buggy source:
public static void setDebugNotification(Context context,String message){
  NotificationManager nm=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  int icon=android.R.drawable.stat_notify_error;
  Notification notification=new Notification(icon,null,System.currentTimeMillis());
  PendingIntent pi=PendingIntent.getActivity(context.getApplicationContext(),1,new Intent("String_Node_Str"),1);
  notification.setLatestEventInfo(context.getApplicationContext(),"String_Node_Str",message,pi);
  nm.notify(124,notification);
}

Fixed version (ground truth):
public static void setDebugNotification(Context context,String message){
  NotificationManager nm=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  int icon=android.R.drawable.stat_notify_error;
  Notification notification=new Notification(icon,null,System.currentTimeMillis());
  PendingIntent pi=PendingIntent.getActivity(context.getApplicationContext(),1,new Intent("String_Node_Str"),1);
  notification.setLatestEventInfo(context.getApplicationContext(),"String_Node_Str",message,pi);
  nm.notify(NOTIF_ERROR_ID,notification);
}