[
https://issues.apache.org/jira/browse/CONFIGURATION-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537247#comment-17537247
]
Matt Juntunen commented on CONFIGURATION-764:
-
I've submitted a new PR
(https://github.com/apache/commons-configuration/pull/182) that changes the
logic in {{looksLikeSingleVariable}} to better detect inputs like this. This
approach requires fewer changes and does not suppress any exceptions. Let me
know what you think.
> Default date lookup can not work for some specific format
> -
>
> Key: CONFIGURATION-764
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-764
> Project: Commons Configuration
> Issue Type: Bug
> Components: Interpolation
>Affects Versions: 2.6
> Environment: Java 1.8.0_144,
> Windows 10/Linux
>Reporter: Ning Zhang
>Priority: Major
> Attachments: 0001-Fix-default-date-lookup-issue.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When default date lookup is like: *${date:MM}/${date:ddHHmmss}*
> It will encounter one exception like:
> _java.lang.IllegalArgumentException: Illegal pattern character 't'_
> But if change date lookup format to : /*${date:MM}/${date:ddHHmmss}*
> There will be not such issue anymore.
> After investigation, found it is caused by _interpolate_ method in
> _ConfigurationInterpolator.java_.
> For the input date lookup format, it is will be taken as single variable via
> _looksLikeSingleVariable_,
> so default date lookup will try to format the date directly then throw one
> exception.
> Attached patch is trying to catch the exception then return null, substitutor
> will continue to work.
>
> PR: https://github.com/apache/commons-configuration/pull/36
--
This message was sent by Atlassian Jira
(v8.20.7#820007)