-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix invalid proxy setting when the port ends with a whitespace #44708
Conversation
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.
Thanks for the pull request! That's indeed something that needs fixing.
Actually, what we should do is fix the config property using @WithConverter(TrimmedStringConverter.class)
instead. That way it's fixed at the source once and for all and we don't have to think about trimming it at all.
There might be other properties there for which it makes sense to use it.
Would you be interested in adjusting your patch to do that instead?
a46e8e6
to
39a5776
Compare
b6ef7c4
to
13a3a24
Compare
Thanks for your hint! I have added this annotation to proxyAddress configuration property. I personally find only this one to be useful, .. due to parsing a number from the string. This is my very first commitment to Quarkus framework, .. so I hope, I am done it properly. |
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.
LGTM, thanks for 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.
Sorry, I had an hesitation before approving and I checked in our code base and for the new @ConfigMapping
config framework, the annotation should be added in the container instead of on the property.
So if you can just make this tiny change, check that everything is OK on your side with this change, and amend your commit, that would be awesome!
@WithConverter(TrimmedStringConverter.class) | ||
Optional<String> proxyAddress(); |
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.
@WithConverter(TrimmedStringConverter.class) | |
Optional<String> proxyAddress(); | |
Optional<@WithConverter(TrimmedStringConverter.class) String> proxyAddress(); |
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.
Thanks for your hint, .. I am sorry, I am too late, .. geoand has already changed it and merge the pull request into quarkusio:main. Great! If I look after the same annotation & Optional, I find 38x occurrences in the codebase; so theoretical I could refactor them to use the same approach everywhere, could not I.
🎊 PR Preview 3ac8d23 has been successfully built and deployed to https://quarkus-pr-main-44708-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
Nice catch, also, here is a real example using it: quarkus/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcTenantConfig.java Line 679 in 3f10b51
|
This comment has been minimized.
This comment has been minimized.
Thanks for this! I updated the PR so it should be good to go now |
Status for workflow
|
Status for workflow
|
Scenario:
A user configures the proxy address (for example in
application.properties
,.env
file etc) and there is a whitespace at the end of the settings like here:'quarkus.rest-client.proxy-address=localhost:8080 '
Error:
After splitting the proxy address, part with the port is a string value like
"8080 "
and Integer.parseInt("8080 ") will throw aNumberFormatException
:Invalid proxy setting. The port is not a number in 'localhost:8080 '