Add a log to track the parsing process.
This commit is contained in:
@@ -35,7 +35,7 @@ public class Parser {
|
|||||||
private String buggyTrees = "";
|
private String buggyTrees = "";
|
||||||
private int maxSize = 0;
|
private int maxSize = 0;
|
||||||
|
|
||||||
public void mineFixPatterns(File prevFile, File revFile, File diffEntryFile) throws FileNotFoundException, IOException {
|
public void parseFixPatterns(File prevFile, File revFile, File diffEntryFile) throws FileNotFoundException, IOException {
|
||||||
// GumTree results
|
// GumTree results
|
||||||
List<HierarchicalActionSet> gumTreeResults = new GumTreeComparer().compareTwoFilesWithGumTree(prevFile, revFile);
|
List<HierarchicalActionSet> gumTreeResults = new GumTreeComparer().compareTwoFilesWithGumTree(prevFile, revFile);
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class TestParser {
|
|||||||
|
|
||||||
Parser parser = new Parser();
|
Parser parser = new Parser();
|
||||||
try {
|
try {
|
||||||
parser.mineFixPatterns(prevFile, revFile, diffentryFile);
|
parser.parseFixPatterns(prevFile, revFile, diffentryFile);
|
||||||
astEditScriptsBuilder.append(parser.getAstEditScripts());
|
astEditScriptsBuilder.append(parser.getAstEditScripts());
|
||||||
sourceCodeBuilder.append(parser.getPatchesSourceCode());
|
sourceCodeBuilder.append(parser.getPatchesSourceCode());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ public class ParseFixPatternActor extends UntypedActor {
|
|||||||
logger.info("Assign a task to worker #" + (i + 1) + "...");
|
logger.info("Assign a task to worker #" + (i + 1) + "...");
|
||||||
}
|
}
|
||||||
} else if ("STOP".equals(message.toString())) {
|
} else if ("STOP".equals(message.toString())) {
|
||||||
counter ++;
|
if (++ counter >= numberOfWorkers) {
|
||||||
logger.info("Worker #" + counter + " finished the work...");
|
|
||||||
if (counter >= numberOfWorkers) {
|
|
||||||
this.getContext().stop(mineRouter);
|
this.getContext().stop(mineRouter);
|
||||||
this.getContext().stop(getSelf());
|
this.getContext().stop(getSelf());
|
||||||
this.getContext().system().shutdown();
|
this.getContext().system().shutdown();
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package edu.lu.uni.serval.MultipleThreadsParser;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import akka.actor.Props;
|
import akka.actor.Props;
|
||||||
import akka.actor.UntypedActor;
|
import akka.actor.UntypedActor;
|
||||||
import akka.japi.Creator;
|
import akka.japi.Creator;
|
||||||
@@ -10,6 +13,7 @@ import edu.lu.uni.serval.FixPatternParser.Parser;
|
|||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
|
|
||||||
public class ParseFixPatternWorker extends UntypedActor {
|
public class ParseFixPatternWorker extends UntypedActor {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(ParseFixPatternActor.class);
|
||||||
|
|
||||||
private String editScriptsFilePath;
|
private String editScriptsFilePath;
|
||||||
private String patchesSourceCodeFilePath;
|
private String patchesSourceCodeFilePath;
|
||||||
@@ -45,18 +49,22 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
File prevFile = msgFile.getPrevFile();
|
File prevFile = msgFile.getPrevFile();
|
||||||
File diffentryFile = msgFile.getDiffEntryFile();
|
File diffentryFile = msgFile.getDiffEntryFile();
|
||||||
Parser miner = new Parser();
|
Parser miner = new Parser();
|
||||||
miner.mineFixPatterns(prevFile, revFile, diffentryFile);
|
log.info("Start to parse file: " + revFile.getPath());
|
||||||
|
miner.parseFixPatterns(prevFile, revFile, diffentryFile);
|
||||||
editScripts.append(miner.getAstEditScripts());
|
editScripts.append(miner.getAstEditScripts());
|
||||||
patchesSourceCode.append(miner.getPatchesSourceCode());
|
patchesSourceCode.append(miner.getPatchesSourceCode());
|
||||||
int size = miner.getMaxSize();
|
int size = miner.getMaxSize();
|
||||||
if (size > maxSize) {
|
if (size > maxSize) {
|
||||||
maxSize = size;
|
maxSize = size;
|
||||||
}
|
}
|
||||||
|
log.info("Finish of parsing file: " + revFile.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHelper.outputToFile(editScriptsFilePath + "edistScripts" + msg.getId() + "_MaxSize=" + maxSize + ".list", editScripts, false);
|
int id = msg.getId();
|
||||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches" + msg.getId() + ".list", patchesSourceCode, false);
|
FileHelper.outputToFile(editScriptsFilePath + "edistScripts" + id + "_MaxSize=" + maxSize + ".list", editScripts, false);
|
||||||
|
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches" + id + ".list", patchesSourceCode, false);
|
||||||
|
|
||||||
|
log.info("Worker #" + id + " finished the work...");
|
||||||
this.getSender().tell("STOP", getSelf());
|
this.getSender().tell("STOP", getSelf());
|
||||||
} else {
|
} else {
|
||||||
unhandled(message);
|
unhandled(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user