+
Skip to content

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

@eeverman

Description

@eeverman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载