Program: 168078
Project: 168078
Buggy source:
/** 
 * Process a CorpusClass of Twitter JSON type. Remove function on completing support for Generic JSON files.
 * @param corpusClass
 * @throws TikaException
 */
private void processJSONArray(CorpusClass corpusClass,boolean seperateFiles){
  JSONParser jParser;
  String corpusClassPath=corpusClass.getTacitLocation();
  String tempDir="String_Node_Str";
  String tempFile="String_Node_Str";
  Date dateobj=new Date();
  StringBuilder sb=new StringBuilder();
  if (doPreprocessing)   tempFile=tempPPFileLoc + corpusClass.getClassName() + System.currentTimeMillis()+ "String_Node_Str";
 else {
    tempDir=ppFilesLoc + System.getProperty("String_Node_Str") + "String_Node_Str"+ dateobj.getTime();
    new File(tempDir).mkdir();
  }
  jParser=new JSONParser();
  dateobj=new Date();
  File[] fileList=new File(corpusClassPath).listFiles();
  for (int i=0; i < fileList.length; i++) {
    try {
      String fileName=fileList[i].getAbsolutePath();
      if (!fileList[i].getAbsolutePath().endsWith("String_Node_Str"))       continue;
      JSONArray objects=(JSONArray)jParser.parse(new FileReader(fileName));
      int j=0;
      boolean first=true;
      boolean lineCheck=true;
      File summary=new File("String_Node_Str");
      BufferedWriter bWriter=new BufferedWriter(new FileWriter(summary));
      for (      Object obj : objects) {
        JSONObject twitterStream=(JSONObject)obj;
        if (first) {
          for (          Object keys : twitterStream.keySet()) {
            String key=(String)keys;
            if (lineCheck) {
              System.out.println(key);
              bWriter.write(key);
              lineCheck=false;
            }
 else {
              System.out.println("String_Node_Str" + key);
              bWriter.write("String_Node_Str" + key);
            }
          }
          lineCheck=true;
          System.out.println("String_Node_Str");
          bWriter.write("String_Node_Str");
          first=false;
        }
        File file;
        List<String> outputs=processQuery(corpusClass,twitterStream);
        if (!outputs.isEmpty() && outputs.get(0) != null && !outputs.get(0).equals("String_Node_Str")) {
          for (          Object keys : twitterStream.keySet()) {
            String key=(String)keys;
            Object val=twitterStream.get(key);
            if (lineCheck) {
              System.out.println("String_Node_Str" + val.toString() + "String_Node_Str");
              bWriter.write("String_Node_Str" + val.toString() + "String_Node_Str");
              lineCheck=false;
            }
 else {
              System.out.println("String_Node_Str" + val.toString() + "String_Node_Str");
              bWriter.write("String_Node_Str" + val.toString() + "String_Node_Str");
            }
          }
          lineCheck=true;
          System.out.println("String_Node_Str");
          bWriter.write("String_Node_Str");
          dateobj=new Date();
          if (doPreprocessing) {
            file=new File(tempFile);
          }
 else {
            file=new File(tempDir + System.getProperty("String_Node_Str") + corpusClass.getClassName()+ j+ "String_Node_Str"+ df.format(dateobj));
          }
          if (file.exists()) {
            file.delete();
          }
          if (seperateFiles) {
            FileWriter fw=new FileWriter(file.getAbsoluteFile());
            BufferedWriter bw=new BufferedWriter(fw);
            String tweet=outputs.get(0);
            bw.write(tweet);
            bw.close();
            if (doPreprocessing) {
              outputFiles.add(processFile(tempFile,corpusClass.getClassName() + "String_Node_Str" + j+ "String_Node_Str"+ df.format(dateobj)));
            }
 else {
              outputFiles.add(checkfiletype(file.getAbsolutePath()));
            }
          }
 else {
            sb.append(outputs.get(0));
          }
        }
        j++;
      }
      bWriter.flush();
      bWriter.close();
      outputFiles.add(summary.getAbsolutePath());
      if (!seperateFiles) {
        File file=new File(tempFile);
        if (file.exists()) {
          file.delete();
        }
        FileWriter fw=new FileWriter(file.getAbsoluteFile());
        BufferedWriter bw=new BufferedWriter(fw);
        bw.write(sb.toString());
        bw.close();
        if (doPreprocessing) {
          outputFiles.add(processFile(tempFile,corpusClass.getClassName() + "String_Node_Str" + j+ "String_Node_Str"+ df.format(dateobj)));
        }
 else {
          outputFiles.add(checkfiletype(file.getAbsolutePath()));
        }
      }
    }
 catch (    JsonParseException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
catch (    ParseException e) {
      e.printStackTrace();
    }
  }
  if (new File(tempFile).exists()) {
    new File(tempFile).delete();
  }
}

Fixed version (ground truth):
/** 
 * Process a CorpusClass of Twitter JSON type. Remove function on completing support for Generic JSON files.
 * @param corpusClass
 * @throws TikaException
 */
private void processJSONArray(CorpusClass corpusClass,boolean seperateFiles){
  JSONParser jParser;
  String corpusClassPath=corpusClass.getTacitLocation();
  String tempDir="String_Node_Str";
  String tempFile="String_Node_Str";
  Date dateobj=new Date();
  StringBuilder sb=new StringBuilder();
  if (!doPreprocessing)   tempFile=tempPPFileLoc + corpusClass.getClassName() + System.currentTimeMillis()+ "String_Node_Str";
 else {
    tempDir=ppFilesLoc + System.getProperty("String_Node_Str") + "String_Node_Str"+ dateobj.getTime();
    new File(tempDir).mkdir();
  }
  jParser=new JSONParser();
  dateobj=new Date();
  File[] fileList=new File(corpusClassPath).listFiles();
  for (int i=0; i < fileList.length; i++) {
    try {
      String fileName=fileList[i].getAbsolutePath();
      if (!fileList[i].getAbsolutePath().endsWith("String_Node_Str"))       continue;
      JSONArray objects=(JSONArray)jParser.parse(new FileReader(fileName));
      int j=0;
      boolean first=true;
      boolean lineCheck=true;
      File summary=new File("String_Node_Str");
      BufferedWriter bWriter=new BufferedWriter(new FileWriter(summary));
      for (      Object obj : objects) {
        JSONObject twitterStream=(JSONObject)obj;
        if (first) {
          for (          Object keys : twitterStream.keySet()) {
            String key=(String)keys;
            if (lineCheck) {
              System.out.println(key);
              bWriter.write(key);
              lineCheck=false;
            }
 else {
              System.out.println("String_Node_Str" + key);
              bWriter.write("String_Node_Str" + key);
            }
          }
          lineCheck=true;
          System.out.println("String_Node_Str");
          bWriter.write("String_Node_Str");
          first=false;
        }
        File file;
        List<String> outputs=processQuery(corpusClass,twitterStream);
        if (!outputs.isEmpty() && outputs.get(0) != null && !outputs.get(0).equals("String_Node_Str")) {
          for (          Object keys : twitterStream.keySet()) {
            String key=(String)keys;
            Object val=twitterStream.get(key);
            if (lineCheck) {
              System.out.println("String_Node_Str" + val.toString() + "String_Node_Str");
              bWriter.write("String_Node_Str" + val.toString() + "String_Node_Str");
              lineCheck=false;
            }
 else {
              System.out.println("String_Node_Str" + val.toString() + "String_Node_Str");
              bWriter.write("String_Node_Str" + val.toString() + "String_Node_Str");
            }
          }
          lineCheck=true;
          System.out.println("String_Node_Str");
          bWriter.write("String_Node_Str");
          dateobj=new Date();
          if (!doPreprocessing) {
            file=new File(tempFile);
          }
 else {
            file=new File(tempDir + System.getProperty("String_Node_Str") + corpusClass.getClassName()+ j+ "String_Node_Str"+ df.format(dateobj));
          }
          if (file.exists()) {
            file.delete();
          }
          if (seperateFiles) {
            FileWriter fw=new FileWriter(file.getAbsoluteFile());
            BufferedWriter bw=new BufferedWriter(fw);
            String tweet=outputs.get(0);
            bw.write(tweet);
            bw.close();
            if (!doPreprocessing) {
              outputFiles.add(processFile(tempFile,corpusClass.getClassName() + "String_Node_Str" + j+ "String_Node_Str"+ df.format(dateobj)));
            }
 else {
              outputFiles.add(checkfiletype(file.getAbsolutePath()));
            }
          }
 else {
            sb.append(outputs.get(0));
          }
        }
        j++;
      }
      bWriter.flush();
      bWriter.close();
      outputFiles.add(summary.getAbsolutePath());
      if (!seperateFiles) {
        File file=new File(tempFile);
        if (file.exists()) {
          file.delete();
        }
        FileWriter fw=new FileWriter(file.getAbsoluteFile());
        BufferedWriter bw=new BufferedWriter(fw);
        bw.write(sb.toString());
        bw.close();
        if (!doPreprocessing) {
          outputFiles.add(processFile(tempFile,corpusClass.getClassName() + "String_Node_Str" + j+ "String_Node_Str"+ df.format(dateobj)));
        }
 else {
          outputFiles.add(checkfiletype(file.getAbsolutePath()));
        }
      }
    }
 catch (    JsonParseException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
catch (    ParseException e) {
      e.printStackTrace();
    }
  }
  if (new File(tempFile).exists()) {
    new File(tempFile).delete();
  }
}