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