Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3195

I18nContentWrapper may also wrap null nodes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.3.2
    • 4.3.1
    • None
    • None

      When using I18nContentSupport the NodeMapWrapper may incorrectly wrap also null values, causing NPEs when trying to access properties.

      This is a sample code (it surely happens using the now deprecated getChildByName() method, but there could be other cases):

      Content test = wrapped.getChildByName("child")
      if (test !=null) {
        test.getNodeData("x");
      } 
      

      Without the content wrapper If getChildByName("child") return nulls everything works fine.
      But If the original node is wrapped, the returned null gets wrapped in a I18nContentWrapper, so that the null check passes but the getNodeData() call will throw a NPE.

        Acceptance criteria

              fgiust Fabrizio Giustina
              fgiust Fabrizio Giustina
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD