Skip to content

Commit

Permalink
Issue #13809: Kill mutation in Checker
Browse files Browse the repository at this point in the history
  • Loading branch information
nrmancuso authored and romani committed Nov 2, 2023
1 parent 3137156 commit 81ac4f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 0 additions & 9 deletions config/pitest-suppressions/pitest-common-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
<lineContent>final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName);</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>Checker.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
<mutatedMethod>processFiles</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/io/File::getPath</description>
<lineContent>throw new Error(&quot;Error was thrown while processing &quot; + file.getPath(), error);</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>Checker.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/puppycrawl/tools/checkstyle/Checker.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ private void fireAuditFinished() {
private void processFiles(List<File> files) throws CheckstyleException {
for (final File file : files) {
String fileName = null;
final String filePath = file.getPath();
try {
fileName = file.getAbsolutePath();
final long timestamp = file.lastModified();
Expand All @@ -308,15 +309,15 @@ private void processFiles(List<File> files) throws CheckstyleException {

// We need to catch all exceptions to put a reason failure (file name) in exception
throw new CheckstyleException("Exception was thrown while processing "
+ file.getPath(), ex);
+ filePath, ex);
}
catch (Error error) {
if (fileName != null && cacheFile != null) {
cacheFile.remove(fileName);
}

// We need to catch all errors to put a reason failure (file name) in error
throw new Error("Error was thrown while processing " + file.getPath(), error);
throw new Error("Error was thrown while processing " + filePath, error);
}
}
}
Expand Down

0 comments on commit 81ac4f5

Please sign in to comment.