This commit is contained in:
Anil Koyuncu
2018-02-24 16:41:38 +01:00
parent 9fa41e6c19
commit b9efc501d2
2 changed files with 31 additions and 13 deletions
@@ -29,9 +29,16 @@ public class TestHunkParser {
// input data // input data
// String rootPath = "/Users/anilkoyuncu/bugStudy"; // String rootPath = "/Users/anilkoyuncu/bugStudy";
String rootPath = args[0]; String inputPath;
String inputPath = args[1]; String outputPath;
String outputPath = args[0] + "/GumTreeOutputBug/"; if(args.length > 0){
inputPath = args[1];
outputPath = args[0] + "/GumTreeOutputBug/";
}else{
inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug";
outputPath = "/Users/anilkoyuncu/bugStudy/dataset" + "/GumTreeOutputBug/";
}
File folder = new File(inputPath); File folder = new File(inputPath);
@@ -33,9 +33,19 @@ public class AkkaParser2 {
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void main(String[] args) { public static void main(String[] args) {
String inputRootPath = args[0]; String inputRootPath;
int numberOfWorkers = Integer.parseInt(args[1]); String outputRootPath;
int hunkThreshold = Integer.parseInt(args[2]); int numberOfWorkers;
if(args.length > 0){
inputRootPath = args[0];
outputRootPath = args[1];
numberOfWorkers = Integer.parseInt(args[2]);
}else{
inputRootPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug";
outputRootPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutputBug/";
numberOfWorkers = 1;
}
// try { // try {
// hunkThreshold = Integer.parseInt(args[2]); // hunkThreshold = Integer.parseInt(args[2]);
// } catch (NumberFormatException e1) { // } catch (NumberFormatException e1) {
@@ -49,13 +59,13 @@ public class AkkaParser2 {
// input data // input data
String GUM_TREE_INPUT = inputRootPath + "GumTreeInput/"; // String GUM_TREE_INPUT = inputRootPath + "GumTreeInput/";
log.info("Get the input data..." + GUM_TREE_INPUT ); log.info("Get the input data..." + inputRootPath );
String outputPath = inputRootPath + "GumTreeResults/";
log.info("Set the output data..." + outputPath ); log.info("Set the output data..." + outputRootPath );
File folder = new File(GUM_TREE_INPUT); File folder = new File(inputRootPath);
File[] listOfFiles = folder.listFiles(); File[] listOfFiles = folder.listFiles();
Stream<File> stream = Arrays.stream(listOfFiles); Stream<File> stream = Arrays.stream(listOfFiles);
List<File> folders = stream List<File> folders = stream
@@ -71,7 +81,7 @@ public class AkkaParser2 {
String pjName = target.getName(); String pjName = target.getName();
// output path // output path
String GUM_TREE_OUTPUT = outputPath + pjName + "/"; String GUM_TREE_OUTPUT = outputRootPath + pjName + "/";
final String editScriptsFilePath = GUM_TREE_OUTPUT + "editScripts.list"; final String editScriptsFilePath = GUM_TREE_OUTPUT + "editScripts.list";
final String patchesSourceCodeFilePath =GUM_TREE_OUTPUT + "patchSourceCode.list"; final String patchesSourceCodeFilePath =GUM_TREE_OUTPUT + "patchSourceCode.list";
final String buggyTokensFilePath = GUM_TREE_OUTPUT + "tokens.list"; final String buggyTokensFilePath = GUM_TREE_OUTPUT + "tokens.list";
@@ -115,7 +125,8 @@ public class AkkaParser2 {
List<MessageFile> msgFiles = new ArrayList<>(); List<MessageFile> msgFiles = new ArrayList<>();
for (File revFile : revFiles) { for (File revFile : revFiles) {
if (revFile.getName().endsWith(".c") || revFile.getName().endsWith(".h")) { // if (revFile.getName().endsWith(".c") || revFile.getName().endsWith(".h")) {
if (revFile.getName().endsWith(".java")) {
String fileName = revFile.getName(); String fileName = revFile.getName();
File prevFile = new File(gumTreeInput + "prevFiles/prev_" + fileName);// previous file File prevFile = new File(gumTreeInput + "prevFiles/prev_" + fileName);// previous file
// fileName = fileName.replace(".java", ".txt"); // fileName = fileName.replace(".java", ".txt");