MyFaces Trinidad
  1. MyFaces Trinidad
  2. TRINIDAD-1229

SetFacetChildDocumentChange adds incomplete facet node to the document

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.9-core
    • Fix Version/s: 1.2.10-core, 1.0.10-core
    • Component/s: None
    • Labels:
      None
    • Environment:
      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.

        Activity

        Hide
        Prakash Udupa added a comment - - edited

        This is a patch over 1.2.9.1 branch. The suggested changes is local to one file, which a.f.a.i.k was unchanged since 1.0 trunk. Hence this patch can be applied for all branches/trunk wherever this needs to go w.r.t. Apache Myfaces Trinidad process.
        I request that this patch be applied over 1.2.9.1 for immediate consumption.

        Show
        Prakash Udupa added a comment - - edited This is a patch over 1.2.9.1 branch. The suggested changes is local to one file, which a.f.a.i.k was unchanged since 1.0 trunk. Hence this patch can be applied for all branches/trunk wherever this needs to go w.r.t. Apache Myfaces Trinidad process. I request that this patch be applied over 1.2.9.1 for immediate consumption.

          People

          • Assignee:
            Matthias Weßendorf
            Reporter:
            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

                Development