Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-1762

DateFormatTransformer does not work correctly with non-default locale dates

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4
    • 1.5
    • None
    • Different locale in the imported data.

    Description

      The DateFormatTransformer assumes the default locale for date transformations.
      If your computer or server has its language set to 'es' and the input file has "November 30, 2009", it'll throw an exception.

      Here's a reproducible test case:
      Define an XML file:
      <awardlist><award><expirationdate>November 30, 2009</expirationdate></award></awardlist>

      Define the data-config.xml with:
      <field column="expirationdate_dt" xpath="/awardslist/award/expirationdate" dateTimeFormat="MMMMM dd, yyyy" />

      It'll throw:
      Exception in thread "main" java.text.ParseException: Unparseable date: "November 30, 2009"

      Attachments

        1. SOLR-1762.patch
          2 kB
          tommy chheng

        Activity

          tcc tommy chheng added a comment -

          This patch checks for a locale attribute and applies it. If no locale attribute is specified, then the default one on the system is used.

          Here's an example of the locale attribute:
          <field column="startdate_dt" xpath="/awardslist/award/startdate" dateTimeFormat="MMMMM dd, yyyy" locale="en" />

          tcc tommy chheng added a comment - This patch checks for a locale attribute and applies it. If no locale attribute is specified, then the default one on the system is used. Here's an example of the locale attribute: <field column="startdate_dt" xpath="/awardslist/award/startdate" dateTimeFormat="MMMMM dd, yyyy" locale="en" />
          noble.paul Noble Paul added a comment -

          committed : r907562
          thanks tommy chheng

          noble.paul Noble Paul added a comment - committed : r907562 thanks tommy chheng

          People

            noble.paul Noble Paul
            tcc tommy chheng
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified