Program: 168072
Project: 168072
Buggy source:
private static void writeRObjforReddit(String outputLoc,CorpusClass cls) throws Exception {
  JSONParser jsonParser=new JSONParser();
  RedditJsonHandler redditJsonHandler=new RedditJsonHandler();
  String saveLocation="String_Node_Str" + outputLoc + File.separator+ cls.getParent().getCorpusName().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ cls.getClassName().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ "String_Node_Str";
  String corpusLocation=cls.getTacitLocation();
  File corpusDirectory=new File(corpusLocation);
  String[] jsonFiles=corpusDirectory.list();
  String corpusName=cls.getClassName().replaceAll("String_Node_Str","String_Node_Str");
  ScriptEngineManager manager=new ScriptEngineManager();
  ScriptEngine engine=manager.getEngineByName("String_Node_Str");
  if (engine == null) {
    throw new Exception("String_Node_Str");
  }
  try {
    String singleRedditLocation="String_Node_Str";
    JSONObject singleReddit=null;
    JSONArray commentArray;
    int maxComments=0;
    for (int i=0; i < jsonFiles.length; i++) {
      if (jsonFiles[i].endsWith("String_Node_Str")) {
        singleRedditLocation=corpusLocation + File.separator + jsonFiles[i];
        singleReddit=(JSONObject)jsonParser.parse(new FileReader(new File(singleRedditLocation)));
        commentArray=(JSONArray)singleReddit.get("String_Node_Str");
        if (commentArray.size() > maxComments) {
          maxComments=commentArray.size();
        }
      }
    }
    String dataFrameHeader="String_Node_Str";
    JSONObject singleRedditContent=(JSONObject)singleReddit.get("String_Node_Str");
    Set<String> keySet=singleRedditContent.keySet();
    Iterator<String> keyIterator=keySet.iterator();
    String key;
    while (keyIterator.hasNext()) {
      key=keyIterator.next();
      engine.eval(key + "String_Node_Str");
      dataFrameHeader=dataFrameHeader + key + "String_Node_Str";
    }
    for (int i=0; i < maxComments; i++) {
      engine.eval("String_Node_Str" + (i + 1) + "String_Node_Str");
      dataFrameHeader=dataFrameHeader + "String_Node_Str" + (i + 1)+ "String_Node_Str";
    }
    dataFrameHeader=dataFrameHeader.substring(0,dataFrameHeader.length() - 1);
    for (int i=0; i < jsonFiles.length; i++) {
      if (jsonFiles[i].endsWith("String_Node_Str")) {
        singleRedditLocation=corpusLocation + File.separator + jsonFiles[i];
        singleReddit=(JSONObject)jsonParser.parse(new FileReader(new File(singleRedditLocation)));
        JSONObject post=(JSONObject)singleReddit.get("String_Node_Str");
        keyIterator=keySet.iterator();
        while (keyIterator.hasNext()) {
          key=keyIterator.next();
          if (post.containsKey(key)) {
            String data=post.get(key).toString();
            data=data.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
            data=data.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").trim();
            engine.eval("String_Node_Str" + data.toString() + "String_Node_Str");
            engine.eval(key + "String_Node_Str" + key+ "String_Node_Str");
          }
 else {
            engine.eval(key + "String_Node_Str" + key+ "String_Node_Str");
          }
        }
        String[] redditPostComments=redditJsonHandler.getPostComments(singleReddit);
        int remainingComments=maxComments;
        if (redditPostComments != null) {
          remainingComments=maxComments - redditPostComments.length;
          int commentCountStamp=1;
          for (          String redditPostComment : redditPostComments) {
            redditPostComment=redditPostComment.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
            redditPostComment=redditPostComment.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").trim();
            engine.eval("String_Node_Str" + redditPostComment + "String_Node_Str");
            engine.eval("String_Node_Str" + commentCountStamp + "String_Node_Str"+ commentCountStamp+ "String_Node_Str");
            commentCountStamp++;
          }
          for (int j=0; j < remainingComments; j++) {
            engine.eval("String_Node_Str" + commentCountStamp + "String_Node_Str"+ commentCountStamp+ "String_Node_Str");
            commentCountStamp++;
          }
        }
 else {
          for (int j=0; j < remainingComments; j++) {
            engine.eval("String_Node_Str" + (j + 1) + "String_Node_Str"+ (j + 1)+ "String_Node_Str");
          }
        }
      }
    }
    engine.eval(corpusName + "String_Node_Str" + dataFrameHeader+ "String_Node_Str");
    engine.eval("String_Node_Str" + corpusName + "String_Node_Str"+ saveLocation+ "String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    ConsoleView.printlInConsoleln("String_Node_Str");
    return;
  }
  ConsoleView.printlInConsoleln("String_Node_Str");
  ConsoleView.printlInConsoleln("String_Node_Str" + saveLocation);
}

Fixed version (ground truth):
private static void writeRObjforReddit(String outputLoc,CorpusClass cls) throws Exception {
  JSONParser jsonParser=new JSONParser();
  RedditJsonHandler redditJsonHandler=new RedditJsonHandler();
  String saveLocation="String_Node_Str" + outputLoc + File.separator+ cls.getParent().getCorpusName().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ cls.getClassName().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ "String_Node_Str";
  saveLocation=saveLocation.replace("String_Node_Str","String_Node_Str");
  String corpusLocation=cls.getTacitLocation();
  File corpusDirectory=new File(corpusLocation);
  String[] jsonFiles=corpusDirectory.list();
  String corpusName=cls.getClassName().replaceAll("String_Node_Str","String_Node_Str");
  ScriptEngineManager manager=new ScriptEngineManager();
  ScriptEngine engine=manager.getEngineByName("String_Node_Str");
  if (engine == null) {
    throw new Exception("String_Node_Str");
  }
  try {
    String singleRedditLocation="String_Node_Str";
    JSONObject singleReddit=null;
    JSONArray commentArray;
    int maxComments=0;
    for (int i=0; i < jsonFiles.length; i++) {
      if (jsonFiles[i].endsWith("String_Node_Str")) {
        singleRedditLocation=corpusLocation + File.separator + jsonFiles[i];
        singleReddit=(JSONObject)jsonParser.parse(new FileReader(new File(singleRedditLocation)));
        commentArray=(JSONArray)singleReddit.get("String_Node_Str");
        if (commentArray.size() > maxComments) {
          maxComments=commentArray.size();
        }
      }
    }
    String dataFrameHeader="String_Node_Str";
    JSONObject singleRedditContent=(JSONObject)singleReddit.get("String_Node_Str");
    Set<String> keySet=singleRedditContent.keySet();
    Iterator<String> keyIterator=keySet.iterator();
    String key;
    while (keyIterator.hasNext()) {
      key=keyIterator.next();
      engine.eval(key + "String_Node_Str");
      dataFrameHeader=dataFrameHeader + key + "String_Node_Str";
    }
    for (int i=0; i < maxComments; i++) {
      engine.eval("String_Node_Str" + (i + 1) + "String_Node_Str");
      dataFrameHeader=dataFrameHeader + "String_Node_Str" + (i + 1)+ "String_Node_Str";
    }
    dataFrameHeader=dataFrameHeader.substring(0,dataFrameHeader.length() - 1);
    for (int i=0; i < jsonFiles.length; i++) {
      if (jsonFiles[i].endsWith("String_Node_Str")) {
        singleRedditLocation=corpusLocation + File.separator + jsonFiles[i];
        singleReddit=(JSONObject)jsonParser.parse(new FileReader(new File(singleRedditLocation)));
        JSONObject post=(JSONObject)singleReddit.get("String_Node_Str");
        keyIterator=keySet.iterator();
        while (keyIterator.hasNext()) {
          key=keyIterator.next();
          if (post.containsKey(key)) {
            String data=post.get(key).toString();
            data=data.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
            data=data.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").trim();
            engine.eval("String_Node_Str" + data.toString() + "String_Node_Str");
            engine.eval(key + "String_Node_Str" + key+ "String_Node_Str");
          }
 else {
            engine.eval(key + "String_Node_Str" + key+ "String_Node_Str");
          }
        }
        String[] redditPostComments=redditJsonHandler.getPostComments(singleReddit);
        int remainingComments=maxComments;
        if (redditPostComments != null) {
          remainingComments=maxComments - redditPostComments.length;
          int commentCountStamp=1;
          for (          String redditPostComment : redditPostComments) {
            redditPostComment=redditPostComment.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
            redditPostComment=redditPostComment.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").trim();
            engine.eval("String_Node_Str" + redditPostComment + "String_Node_Str");
            engine.eval("String_Node_Str" + commentCountStamp + "String_Node_Str"+ commentCountStamp+ "String_Node_Str");
            commentCountStamp++;
          }
          for (int j=0; j < remainingComments; j++) {
            engine.eval("String_Node_Str" + commentCountStamp + "String_Node_Str"+ commentCountStamp+ "String_Node_Str");
            commentCountStamp++;
          }
        }
 else {
          for (int j=0; j < remainingComments; j++) {
            engine.eval("String_Node_Str" + (j + 1) + "String_Node_Str"+ (j + 1)+ "String_Node_Str");
          }
        }
      }
    }
    engine.eval(corpusName + "String_Node_Str" + dataFrameHeader+ "String_Node_Str");
    engine.eval("String_Node_Str" + corpusName + "String_Node_Str"+ saveLocation+ "String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    ConsoleView.printlInConsoleln("String_Node_Str");
    return;
  }
  ConsoleView.printlInConsoleln("String_Node_Str");
  ConsoleView.printlInConsoleln("String_Node_Str" + saveLocation);
}