Skip checking binary files for possible JUnit dependencies #886
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR
The
checkJUnitDependencies
task would attempt to scan all files in a source set, including binary files such assrc/test/resources/server_keystore.jks
, which would lead to ajava.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1
(seehttps://circleci.com/gh/palantir/tritium/4234 & palantir/tritium#439 ):
After this PR
==COMMIT_MSG==
Treat MalformedInputException as binary files that are not necessary to
scan for old JUnit dependencies.
Rethrow any non-IOExeception (such as UncheckedIOException wrapping
MalformedInputException) with more useful error message indicating a
file could not be scanned (e.g. src/test/resources/server_keystore.jks).
==COMMIT_MSG==
Possible downsides?
This method of attempting to exclude non-source files may potentially have false-negatives of not flagging old JUnit dependencies in a source file if it were to trigger a
MalformedInputException
while reading (e.g. if the source file was notUTF-8
but insteadUTF-16
orUCS-2
per https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.1)