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

Set a RichText as docbook in EditContentFunction throws a NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.2.0
    • 3.9
    • Workflow
    • None

      On line 3532 of EditContentFunction, we get the additional data like this :

      field.getAdditionalData();

      Then we test if additional data is null.

      But here is the code of this method:

      /**
       * Get the additional data.
       * @return the additional data.
       */
      public Map<String, Resource> getAdditionalData()
      {
          return Collections.unmodifiableMap(_additionalData);
      }

      If _additionalData is null, it throws a NullPointerException. Should it be tested before or I have to set additional data ?

      You can test it like this:

      /**
       * Get the additional data.
       * @return the additional data.
       */
      public Map<String, Resource> getAdditionalData()
      {
          return _additionalData == null ? null : Collections.unmodifiableMap(_additionalData);
      }

      And the current code to set additional data in this case is (EditContentFunction, line 1483):

      Map<String, Resource> addData = (Map<String, Resource>) rawValues.get(metadataParamsPrefix + ".additionalData");
      [...]                
      if (addData != null)
      {
          field.setAdditionalData(addData);
      }

      Then it should be able to be null.

      Consequence: It's impossible to directly set a rich text as docbook (not html to transform).

            Unassigned Unassigned
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: