Uploaded image for project: 'Santuario'
  1. Santuario
  2. SANTUARIO-349

Update JCP dsig code to simplify serialization

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Java 1.5.2, Java 1.5.3
    • Java 2.0.0
    • Java
    • Security Level: Public (Public issues, viewable by everyone)

    Description

      In working on the Santuario port to GenXDM, I discovered that the serialization code for the org.apache.jcp.xml.dsig.internal.dom package turns out to be highly repetitive.

      For example, code like this:

      Document ownerDoc = DOMUtils.getOwnerDocument(parent);
      // prepend namespace prefix, if necessary
      Element knElem = DOMUtils.createElement(ownerDoc, "KeyName",
      XMLSignature.XMLNS, dsPrefix);
      knElem.appendChild(ownerDoc.createTextNode(name));
      parent.appendChild(knElem);

      can be replaced by:

      xwriter.writeTextElement(dsPrefix, "KeyName", XMLSignature.XMLNS, keyName.getName());

      ... which both reduces the amount of code, and better exposes the intent.

      Attachments

        1. SANTUARIO-349.patch
          159 kB
          Eric Johnson
        2. SANTUARIO-349-try2.patch
          180 kB
          Eric Johnson

        Issue Links

          Activity

            People

              coheigea Colm O hEigeartaigh
              eric@tibco.com Eric Johnson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: