[FLINK-39687] [sql-gateway] Fix URI dependency conversion in SessionContext#28529
Open
qiuyanjun888 wants to merge 2 commits into
Open
[FLINK-39687] [sql-gateway] Fix URI dependency conversion in SessionContext#28529qiuyanjun888 wants to merge 2 commits into
qiuyanjun888 wants to merge 2 commits into
Conversation
Collaborator
spuru9
reviewed
Jun 25, 2026
| private static URL toURL(URI uri) { | ||
| try { | ||
| return uri.toURL(); | ||
| } catch (MalformedURLException e) { |
Contributor
There was a problem hiding this comment.
nit: a plain --jar foo.jar is a schemeless URI, so toURL() throws IllegalArgumentException, not MalformedURLException — dodges this catch. Add it?
Suggested change
| } catch (MalformedURLException e) { | |
| } catch (MalformedURLException | IllegalArgumentException e) { |
Author
There was a problem hiding this comment.
Fixed by catching IllegalArgumentException alongside MalformedURLException and wrapping it in SqlGatewayException; added a regression test for URI.create("foo.jar").
Verification: ./mvnw -pl flink-table/flink-sql-gateway -Dtest=SessionContextTest test -DfailIfNoTests=false passed, and git diff --check passed.
spuru9
approved these changes
Jun 25, 2026
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.
What is the purpose of the change
This pull request fixes
SessionContextcreation when the default SQL Gateway context contains dependency URIs. The previous code passedList<URI>elements totoArray(new URL[0]), which throwsArrayStoreExceptionas soon as the dependency list is non-empty.Brief change log
URIto aURLbefore creating the session user-code classloader.SessionContextTestregression test that creates a session from aDefaultContextwith a non-empty dependency list and verifies the dependency URL is available from the user-code classloader.Verifying this change
This change added tests and can be verified as follows:
./mvnw -pl flink-table/flink-sql-gateway -Dtest=SessionContextTest#testCreateContextWithDependencies -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dfast test./mvnw -pl flink-table/flink-sql-gateway -Dtest=SessionContextTest -Dfast test./mvnw -pl flink-table/flink-sql-gateway spotless:check checkstyle:checkI also verified that the new regression test fails against the previous production implementation with
java.lang.ArrayStoreException: java.net.URI.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Hermes Agent / OpenAI GPT-5.5