[SPARK-20816][CORE] MetricsConfig doen't trim the properties file cau… #18041
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.
…se the exception very confused
What changes were proposed in this pull request?
Spark Metrics System use a Properties File to load the configurations but doesn't trim the keys and values. It might cause the exception very confused if the property is a class name.
For example below, you must do not notice there is a space at the line end.
Unfortunately, the ClassNotFoundException throwing from Driver also doesn't tell me what happens and confuses me because I am sure the related jar is in the CLASSPATH.
As a reference, I check the code of Log4j, a classic Properties using library. It do the trim when load the properties. See org.apache.log4j.filter.PropertyFilter.java
How was this patch tested?
Add unit tests
Also can test manually by setting metrics.properties file
(Replace "_" with " ")