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

Plugin ODF: possible NPE when no language node

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.9.18, 2.9.20
    • 2.9.17
    • Plugins (others)
    • None

      JCREntity.getProperty()
      Node nodeLanguage = getLanguageNode(language);
      if (nodeLanguage.hasProperty(propertyName))
      {
         return nodeLanguage.getProperty(propertyName);
      }
      

      If the content doesn't have a language node, getLanguageNode() returns null and a NPE is thrown on the next line. The nullity of nodeLanguage should be tested before calling hasProperty() on it.

          [CMS-678] Plugin ODF: possible NPE when no language node

          JCREntity.GetProperty()
          Node syncNode;
          
          if (language == null)
          {
              syncNode = _node;
          }
          else
          {
              syncNode = getLanguageNode(language);
          }
          
          boolean isSync = syncNode.getProperty(propertyName + SYNC_SUFFIX).getBoolean();
          

          syncNode can be null -> the getProperty() call on the last line will crash.

          Nicolas Gavalda (Inactive) added a comment - JCREntity.GetProperty() Node syncNode; if (language == null ) { syncNode = _node; } else { syncNode = getLanguageNode(language); } boolean isSync = syncNode.getProperty(propertyName + SYNC_SUFFIX).getBoolean(); syncNode can be null -> the getProperty() call on the last line will crash.

            Unassigned Unassigned
            ngavalda Nicolas Gavalda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: