Remove error message on recovery success#1856
Merged
ctubbsii merged 1 commit intoapache:mainfrom Jan 7, 2021
Merged
Conversation
Fix an error message that the stream is closed after a successful recovery in LogSorter.java. This occurred because a try-with-resources block automatically closed the file input stream, and then it was attempted to be closed again in the finally block in the LogSorter.LogProcessor.sort() method. This resulted in an error message always being shown in the finally block, even if the try-with-resources block successfully finished without error and closed the input stream already. This change removes the use of try-with-resources, and relies on the finally block to close the resources once. Related changes include: * Remove unnecessary wrapping class to carry the original input stream alongside the decrypting wrapper input stream, since the original input stream is already available to all callers, and it was only used to get the decrypting wrapper input stream. The decrypting input stream can now be retrieved directly instead of placing it in a new holder object. The method to get the decrypting stream was renamed and a javadoc was added to make it easier to understand what it does. * Change LogHeaderIncompleteException to not be a subclass of IOException, so that it can be explicitly caught, and not easily overlooked when handling other IOExceptions. Its cause parameter type was also narrowed to the EOFException, which is the only valid exception to cause the LogHeaderIncompleteException to be thrown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix an error message that the stream is closed after a successful
recovery in LogSorter.java. This occurred because a try-with-resources
block automatically closed the file input stream, and then it was
attempted to be closed again in the finally block in the
LogSorter.LogProcessor.sort() method. This resulted in an error message
always being shown in the finally block, even if the try-with-resources
block successfully finished without error and closed the input stream
already. This change removes the use of try-with-resources, and relies
on the finally block to close the resources once.
Related changes include:
alongside the decrypting wrapper input stream, since the original
input stream is already available to all callers, and it was only used
to get the decrypting wrapper input stream. The decrypting input
stream can now be retrieved directly instead of placing it in a new
holder object. The method to get the decrypting stream was renamed and
a javadoc was added to make it easier to understand what it does.
IOException, so that it can be explicitly caught, and not easily
overlooked when handling other IOExceptions. Its cause parameter type
was also narrowed to the EOFException, which is the only valid
exception to cause the LogHeaderIncompleteException to be thrown.