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

          Cédric Damioli made changes -
          Workflow Original: jira [ 11883 ] New: Ametys [ 13912 ]
          Nicolas Gavalda (Inactive) made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]
          Julien Couret (Inactive) made changes -
          Project Import New: Thu May 28 17:09:53 UTC 2009 [ 1243530593866 ]
          Nicolas Gavalda (Inactive) made changes -
          Fix Version/s New: 2.9.20 [ 11906 ]
          Resolution New: Fixed [ 1 ]
          Status Original: Reopened [ 4 ] New: Resolved [ 5 ]
          Nicolas Gavalda (Inactive) made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

          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.
          Nicolas Gavalda (Inactive) made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Nicolas Gavalda (Inactive) created issue -

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

              Created:
              Updated:
              Resolved: