[common] Propagate checked IOException from RESTTokenFileIO#fileIO - #9638
Open
LuciferYang wants to merge 1 commit into
Open
[common] Propagate checked IOException from RESTTokenFileIO#fileIO#9638LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
fileIO() is declared throws IOException but wrapped the one FileIO.get raises into UncheckedIOException, so a data token that cannot produce an inner FileIO bypassed every caller written for the signature, including the catch blocks in paimon-lance and paimon-vortex.
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.
Purpose
close #9637
RESTTokenFileIO.fileIO()is declaredthrows IOExceptionand then converted the one it gets into an unchecked wrapper:So a data token that cannot produce an inner FileIO surfaced as
UncheckedIOExceptionfrom whichever FileIO call triggered the lazy creation, past every caller written for the declared signature. Two of those live outside paimon-common and can never run as things stand:Letting the
IOExceptionthrough is all this needs. The signature does not change, so no caller has to, and the two above start reporting what they were written to report. The cache is keyed byRESTToken, so this path runs again on every token refresh rather than once at startup.Tests
RESTTokenFileIOTest.testFileIOCreationFailureSurfacesAsCheckedIOExceptionbuilds aRESTTokenFileIOover a scheme no loader can serve, with a unique token so the static token-keyed cache cannot hand back another test's delegate, and asserts thatexistsfails with anIOException.Against the unfixed code that assertion fails on the type: what comes out is
java.io.UncheckedIOExceptionwrapping anUnsupportedSchemeException.mvn -pl paimon-common -Dtest=RESTTokenFileIOTest teston JDK 8: 5 tests, 0 failures.spotless:checkandcheckstyle:checkon paimon-common are clean.