Skip to content

Conversation

thecoop
Copy link
Contributor

@thecoop thecoop commented Aug 28, 2025

Most of the remaining ones are in backwards-compatible codecs and the test framework

@thecoop thecoop added the skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check. label Aug 28, 2025
} else {
IOUtils.deleteFilesIgnoringExceptions(tempDir, sortedFile);
}
tempDir.deleteFile(sortedFile);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exceptions thrown by this should be handled by the method calling this close() method

if (success) {
IOUtils.close(reader, dir);
} else {
IOUtils.closeWhileHandlingException(reader, writer, dir);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new code implicitly calls close() on writer after rollback() has been called, but IndexWriter can handle that

@uschindler
Copy link
Contributor

This one is more complicated than the others. Especially the first file is hard. Why was it possible to remove success without any other code change?

@thecoop
Copy link
Contributor Author

thecoop commented Sep 1, 2025

You mean SortingStrategy? sortedFile was being closed in all situations anyway, but this change makes it throw any exceptions regardless. This is ok because this is only used in hunspell.Dictionary, which iterates through the EntrySorter here.

That loop only exits normally once it gets to the end (returns null), all other possible exits of that loop are through exceptions. The exception will bubble up to the caller, where the try block will call EntrySorter.close. If that throws an exception (which it didn't previously), it'll be added as suppressed to the original exception, so the original behaviour is maintained. The only difference is that an exception while closing the file will be added as suppressed, rather than being thrown away completely.

Copy link
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!

@github-actions github-actions bot added the Stale label Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants