Skip to content

Commit 21e1bb4

Browse files
committed
fix: issues on file normalization
1 parent eecf738 commit 21e1bb4

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/main/services/dataCollectors/fileSyntacticNormalization/BaseFileSyntacticNormalizationDataCollector.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ abstract class BaseFileSyntacticNormalizationDataCollector implements DataCollec
2727
def files = MergeScenarioCollector.collectNonFastForwardMergeScenarios(project, mergeCommit)
2828
files.parallelStream().forEach(file -> {
2929
LOG.debug("Starting to run file normalization in file ${inputFile}")
30+
31+
if (!Files.exists(file.resolve(inputFile))) {
32+
LOG.debug("Skipping normalization because file ${file.resolve(inputFile)} do not exist")
33+
return
34+
}
35+
if (!Files.exists(file.resolve(outputFile))) {
36+
LOG.debug("Skipping normalization because file ${file.resolve(outputFile)} do not exist")
37+
return
38+
}
39+
3040
def isSuccess = runNormalizationOnFile(file.resolve(inputFile), file.resolve(outputFile))
3141
if (!isSuccess) {
3242
LOG.debug("Failed to run file normalization in file ${inputFile}, falling back to copy the file")

src/main/services/dataCollectors/fileSyntacticNormalization/JDimeFileSyntacticNormalizationDataCollector.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ class JDimeFileSyntacticNormalizationDataCollector extends BaseFileSyntacticNorm
2626

2727
def output = ProcessRunner.startProcess(processBuilder)
2828
def hasCompleted = output.waitFor(1, TimeUnit.HOURS)
29-
return hasCompleted && output.exitValue() != 0
29+
return hasCompleted && output.exitValue() == 0
3030
}
3131
}

src/main/services/dataCollectors/fileSyntacticNormalization/SporkFileSyntacticNormalizationDataCollector.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import org.apache.logging.log4j.LogManager
44
import org.apache.logging.log4j.Logger
55
import util.ProcessRunner
66

7-
import java.nio.file.Files
87
import java.nio.file.Path
98
import java.util.concurrent.TimeUnit
109

@@ -27,7 +26,7 @@ class SporkFileSyntacticNormalizationDataCollector extends BaseFileSyntacticNorm
2726
process.getInputStream().eachLine(LOG::trace)
2827
process.getErrorStream().eachLine(LOG::warn)
2928
def hasCompleted = process.waitFor(1, TimeUnit.HOURS)
30-
return hasCompleted && Files.exists(outputFile)
29+
return hasCompleted && process.exitValue() == 0
3130
}
3231

3332
private static List<String> getBuildParameters(Path inputFile, Path outputFile) {

0 commit comments

Comments
 (0)