Fix JDBC URL parsing crash when no port specified#11550
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8a5e56949
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
amarziali
left a comment
There was a problem hiding this comment.
thanks for fixing that. I left a couple of suggestions to encourage using TableTest in the the junit
| class JDBCConnectionUrlParserDB2Test { | ||
|
|
||
| @ParameterizedTest | ||
| @CsvSource({ |
There was a problem hiding this comment.
you can use @TableTest that we're actively using in the groovy to junit migration
There was a problem hiding this comment.
Thanks, fixed
| // databasename param in query string should be parsed into db field | ||
| "jdbc:db2://db2.host/mydb?user=db2user&databasename=otherdb, db2, db2.host, db2user, otherdb", | ||
| }) | ||
| void db2UrlWithDatabasenameQueryParamShouldParseDbCorrectly( |
There was a problem hiding this comment.
you can collapse the two test since the assertions look the same
There was a problem hiding this comment.
Good point! Thanks
3bf77c8 to
34ed85a
Compare
34ed85a to
344efdb
Compare
…n no port is specified
344efdb to
1150580
Compare
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
Guards the
lastIndexOf(':')split inMODIFIED_URL_LIKE.doParse()so it only splits on a colon that appears after://. If no such colon exists, the full URL is used as-is.Motivation
DB2/AS400 JDBC URLs without an explicit port that contain
=caused a crash in the agent:The root cause: when a URL like
jdbc:db2://host/db?user=foois parsed, the code useslastIndexOf(':')to find the parameter section separator. With no explicit port, the only:is the scheme colon (position 3), sourlPart1is cut to just"db2". The subsequenturlPart1.substring(hostIndex + 3)- i.e."db2".substring(6)- throwsURLs that trigger the bug:
URLs that work fine (explicit port puts a
:past://):Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-levelJira ticket: [PROJ-IDENT]