Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-764

Default date lookup can not work for some specific format

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6
    • 2.8.0
    • Interpolation
    • None
    • Java 1.8.0_144,

      Windows 10/Linux

    Description

      When default date lookup is like: ${date:yyyyMM}/${date:ddHHmmss}

      It will encounter one exception like:

      java.lang.IllegalArgumentException: Illegal pattern character 't'

      But if change date lookup format to : /${date:yyyyMM}/${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

      Attachments

        Activity

          People

            Unassigned Unassigned
            ningzhangnj Ning Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m