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

Property values can behave unexpectedly with trailing spaces #22740

Closed
paulrobinson opened this issue Jan 7, 2022 · 3 comments · Fixed by #23367
Closed

Property values can behave unexpectedly with trailing spaces #22740

paulrobinson opened this issue Jan 7, 2022 · 3 comments · Fixed by #23367
Assignees
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@paulrobinson
Copy link
Contributor

Describe the bug

If a trailing space (or presumably another whitespace character) is present at the end of a value in the src/main/resources/application.properties file, it is passed verbatim (not trimmed) to the user of the property (in at least one case, see reproducer below).

Expected behavior

I would expect trailing (or proceeding) whitespace in a property value to be trimmed. I think it should only be preserved if the value is quoted somehow.

Actual behavior

In some cases the trailing whitespace remains when the property is used. See the reproducer for one such case.

How to Reproduce?

Reproducer:

  1. Run the https://quarkus.io/guides/opentelemetry example.
  2. When populating the application.properties file, copy and past from the code block in the guide
  3. Observe that. whitespace character has been added to the end of every property value in the application.properties file.
  4. When starting Quarkus, observe: Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: http://localhost:4317
  5. Remove the traiing white space from quarkus.opentelemetry.tracer.exporter.otlp.endpoint=http://localhost:4317 in the application.properties.
  6. Re-run Quarkus and observe that the above exception is not thrown.

Output of uname -a or ver

Darwin Pauls-Mac-mini-5.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.7" 2020-04-14

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /Users/paul/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 Java version: 11.0.7, vendor: AdoptOpenJDK, runtime: /Users/paul/.sdkman/candidates/java/11.0.7.hs-adpt Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

Additional information

No response

@paulrobinson paulrobinson added the kind/bug Something isn't working label Jan 7, 2022
@gsmet
Copy link
Member

gsmet commented Jan 7, 2022

The general rule of thumb is:

  • spaces are preserved as they should be given how .properties file are supposed to work
  • we have a converter that can trim strings and we apply it on a per case basis (it might be missing for a ton of properties as we usually apply it when we think about it or when we have a report)

/cc @radcortez

@radcortez
Copy link
Member

I'll have a look and check which OTel configs require the trimming converter.

@paulrobinson
Copy link
Contributor Author

Thanks @radcortez!

@gsmet gsmet modified the milestones: 2.8 - main, 2.7.1.Final Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants