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

Trimming is not applied to non-String Property values in some cases #659

Closed
eeverman opened this issue Oct 19, 2021 · 1 comment · Fixed by #661
Closed

Trimming is not applied to non-String Property values in some cases #659

eeverman opened this issue Oct 19, 2021 · 1 comment · Fixed by #661
Labels
Milestone

Comments

@eeverman
Copy link
Owner

eeverman commented Oct 19, 2021

Describe the bug
The BaseLoader.createValue method is where trimming is supposed to happen for properties, but it is not happening for non-String Properties. This perhaps due to bad variable names and a bad precedent set in some ValueTypes, which were performing trimming in their parse method (even though the values are supposed to be trimmed when passed).

This seems like a huge bug, but it actually doesn't show up for the most part:

  • java.util.Properties trims leading spaces and IDEs generally remove trailing spaces
  • Env vars and Sys Props generally don't have extra whitespace (but could)
  • JNDI values generally don't have extra whitespace

Some ValueTypes do trim String values:

  • BolType
  • FlagType

To Reproduce
Create a property file with trailing whitespace on a non-String value - it will report a loader problem like this:

The string '80   ' could not be converted to type Integer

Expected behavior / Actual behavior
Non-String values should always be trimmed with the trimmer assigned to the Property.

@eeverman
Copy link
Owner Author

Fixed by #661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant