Repository navigation
fix(jdbc): ignore unsupported socketTimeout instead of throwing - #226
Merged
Merged
Conversation
The timeout branch guarded on connectTimeout or socketTimeout but always read connectTimeout, so a URL with only socketTimeout threw NumberFormatException from Long.parseLong(null) at parse time. Take socketTimeout out of the guard so the parameter is ignored like any other unknown parameter. LibsqlClientConfig has no socket timeout field, and mapping it onto the connect timeout would change behavior that callers did not ask for.
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.
Fixes #196
Problem
LibsqlUrlParserguarded the timeout branch onconnectTimeoutorsocketTimeout, but always readconnectTimeout:Long.parseLong(null)throwsNumberFormatException, sojdbc:libsql:http://localhost:8080/dev/tenant?socketTimeout=5000failed at parse time with an unchecked exception.Fix
Remove
socketTimeoutfrom the guard. It is now ignored like any other unknown URL parameter. It is not mapped onto the connect timeout, and the driver gains no socket-timeout support in this PR. All other precedence rules are unchanged: queryconnectTimeoutstill wins over thePropertiesvalue, which still wins over the default.Red (test first, before the fix)
Command:
./mvnw -pl libsql-jdbc -am -Dtest=LibsqlUrlParserTest -Dsurefire.failIfNoSpecifiedTests=false testGreen (after the fix)
Same command as the red run.
Lanes
./mvnw test— BUILD SUCCESS;libsql-jdbc398 tests, 0 failures, 0 errors../mvnw spotless:check— BUILD SUCCESS../mvnw -pl libsql-conformance -am verify— BUILD SUCCESS; 272 tests, 0 failures, 0 errors, 7 skipped (against the pinnedsqldimage).Tests
testIgnoresSocketTimeoutWithoutConnectTimeout—socketTimeoutalone parses, keeps the URL, and leavesconnectTimeoutat the default. Fails before the fix.testConnectTimeoutStillWinsAlongsideSocketTimeout— with both parameters present,connectTimeoutstill applies.Existing
LibsqlUrlParserTestassertions are untouched.