Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-1229

SetFacetChildDocumentChange adds incomplete facet node to the document

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.9-core
    • 1.2.10-core, 1.0.10-core
    • None
    • None
    • All environments

    Description

      The following is the current code in org.apache.myfaces.trinidad.change.SetFacetChildDocumentChange class:

      public void changeDocument(Node componentNode)
      {
      if (componentNode == null)
      throw new IllegalArgumentException(_LOG.getMessage(
      "NO_NODE_SPECIFIED"));

      // get the fragement, imported into the target document
      DocumentFragment targetFragment = getImportedComponentFragment(componentNode);

      Element facetElement = ChangeUtils.__getFacetElement(componentNode, _facetName);

      if (facetElement != null)

      { // remove any current children ChangeUtils.__removeAllChildren(facetElement); }

      else

      { Document targetDocument = componentNode.getOwnerDocument(); facetElement = targetDocument.createElementNS(_JSF_CORE_NAMESPACE, "f:facet"); // ISSUE IS THAT THIS FACET ELEMENT DOES NOT HAVE 'name' ATTRIBUTE ON IT // set the xmlns for the prefix to make sure that "f:" is the // prefix for faces // =-= bts TODO In theory, this could cause problems if the // added component used the prefix "f:" for something other than // the JSF core facetElement.setAttributeNS(_XMLNS_NAMESPACE, "xmlns:f", _JSF_CORE_NAMESPACE); componentNode.appendChild(facetElement); }

      // add our new facet content
      facetElement.appendChild(targetFragment);
      }

      When a new SetFacetChildDocumentChange is created and added to the change manager, and in case the target component did not have a facet already, a new facet element is created wrapping the supplied document fragment, and added. The problem, is that the 'name' attribute is added on the element, as indicated by comments in the code above. This results in parse exceptions by JSP engines.

      Fix is to add the 'name' attribute. I'll provide a patch soon.

      Attachments

        Activity

          People

            matzew Matthias Wessendorf
            pudupa Prakash Udupa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified