Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve whitespace handling in oracle jdbc url parser #12512

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,12 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
},

ORACLE_AT() {
private final Pattern descriptionPattern = Pattern.compile("@\\s*\\(\\s*description");
Copy link
Contributor

Choose a reason for hiding this comment

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

For constant, use capital here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as far as I know our coding rules do not allow using upper case for non static fields

Copy link
Member

Choose a reason for hiding this comment

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


@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
if (jdbcUrl.contains("@(description")) {
if (descriptionPattern.matcher(jdbcUrl).find()) {
return ORACLE_AT_DESCRIPTION.doParse(jdbcUrl, builder);
}
String user;
Expand Down Expand Up @@ -565,7 +567,7 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {

/**
* This parser can locate incorrect data if multiple addresses are defined but not everything is
* defined in the first block. (It would locate data from subsequent address blocks.
* defined in the first block. It would locate data from subsequent address blocks.
*/
ORACLE_AT_DESCRIPTION() {
private final Pattern hostPattern = Pattern.compile("\\(\\s*host\\s*=\\s*([^ )]+)\\s*\\)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
.setPort(666)
.setName("orclsn")
.build(),
arg("jdbc:oracle:thin:@(description = (connect_timeout=90)(retry_count=20)(retry_delay=3) (transport_connect_timeout=3000) (address_list = (load_balance = on) (failover = on) (address = (protocol = tcp)(host = orcl.host1)(port = 1521)) (address = (protocol = tcp)(host = orcl.host2)(port = 1521)) (address = (protocol = tcp)(host = orcl.host3)(port = 1521)) (address = (protocol = tcp)(host = orcl.host4)(port = 1521)) ) (connect_data = (server = dedicated) (service_name = orclsn)))")
arg("jdbc:oracle:thin:@ ( description = (connect_timeout=90)(retry_count=20)(retry_delay=3) (transport_connect_timeout=3000) (address_list = (load_balance = on) (failover = on) (address = (protocol = tcp)(host = orcl.host1 )(port = 1521 )) (address = (protocol = tcp)(host = orcl.host2)(port = 1521)) (address = (protocol = tcp)(host = orcl.host3)(port = 1521)) (address = (protocol = tcp)(host = orcl.host4)(port = 1521)) ) (connect_data = (server = dedicated) (service_name = orclsn)))")
.setShortUrl("oracle:thin://orcl.host1:1521")
.setSystem("oracle")
.setSubtype("thin")
Expand Down
Loading