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
Feature/urlparser improve3 pr1 #2641
Merged
davecramer
merged 6 commits into
pgjdbc:master
from
MarekUniq:feature/urlparser-improve3-pr1
Oct 17, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d450878
refactoring: PGPropertyPasswordParser, PGPropertyServiceParser moved …
MarekUniq f5606c8
fix: loglevel -> loggerLevel (there is no property loglevel)
MarekUniq 8635ab3
remove usage of environment variables (it eliminates need for cleanup)
MarekUniq 18a8e20
replace hard-coded property values with references to PGProperty enum
MarekUniq 6219a0b
rename: PGProperty.get() -> getOrDefault() because it returns value a…
MarekUniq c063b06
remove references to logLevel and loggerLevel
MarekUniq File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a severe breakage of the public API.
Previously
.get
did take the default value into the consideration, while nowget
ignores the default value.I believe code like
PGProperty.PG_HOST.get(properties)
is used in the wild, and it looks like it would change the behavior after this change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert it. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively we could just fix PGProperty.PG_HOST.get(properties) so that it worked as before ? Do you have any issues with the rest of the PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I should have figured it out myself that get() could be used by external libraries.
Can I make rollback commit to the same PR here and it can be merged again? (or new PR is required)
What could be the name of another method:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the only issue with this PR is that get should be reverted we can just fix that as per PR # 2644
After contemplating this a bit, I'm not sure of the value of using getOrDefault ?
@vlsi do you have any other issues with the PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we can probably keep
getOrDefault
so it explicitly conveys the behavior.We can keep
get()
which would delegate togetOrDefault
, and mark it as@Deprecated
(without intention to remove the method), so the clients who use the methods could either migrate to the "new"getOrDefault
orgetWithoutDefault
, etc.I think
getOrNull(...)
would be better alternative thangetWithoutDefault
andgetIgnoringDefault
.AFAIK,
Properties
(andHashtable
) does not supportnull
values, andorNull
in the method name gives an explicit warning that the method can returnnull
.I don't like
getNoDefault
.Yet another alternative could be
getIgnoringDefault
, however, I thinkgetOrNull
is better for "get value or return null if it is missing in the properties".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davecramer
yes, that's good
@vlsi
I like it.