Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-561

Errors when saving a date field in a structured content

XMLWordPrintable

      The HandleFormSubmitAction catches a ParseException and logs an error message when a date is not readable, event if the date is empty (when we want to remove it, for example).

      So it is currently not possible to remove a date once it's been set.

      saveMetadataAsDate(Request, CompositeMetadata, String) from HandleFormSubmitAction
      String dateToParse = "";
      try
      {
          Date[] dateValues = new Date[values.length];
          for (int i = 0; i < values.length; i++)
          {
              dateToParse = values[i];
              dateValues[i] = df.parse(dateToParse);
          }
          metaHolder.setMetadata(metadataName, dateValues);
      }
      catch (ParseException e)
      {
          _logger.error("Unable to parse date " + dateToParse + ", it will be ignored for metadata " + metadataName, e);
      }
      

            Unassigned Unassigned
            nesteso Nicolas Esteso (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: