https://issues.apache.org/bugzilla/show_bug.cgi?id=47762

           Summary: contextChild parameter of Transform.getInstance may be
                    null
           Product: Security
           Version: Java 1.4.2
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Signature
        AssignedTo: security-dev@xml.apache.org
        ReportedBy: julienpasqu...@free.fr


--- Comment #0 from Julien Pasquier <julienpasqu...@free.fr> 2009-08-28 
11:16:37 PDT ---
The following method of the class org.apache.xml.security.transforms.Transform
does not test if the contextChild parameter is null:
public static final Transform getInstance(
    Document doc, 
    String algorithmURI, 
    Element contextChild)

I propose this modified code to fix this bug:
public static final Transform getInstance(
    Document doc, String algorithmURI, Element contextChild)
    throws InvalidTransformException {

    HelperNodeList contextNodes = null;

    if (contextChild != null) {
        contextNodes = new HelperNodeList();

        XMLUtils.addReturnToElement(doc, contextNodes);
        contextNodes.appendChild(contextChild);
        XMLUtils.addReturnToElement(doc, contextNodes);
    }

    return Transform.getInstance(doc, algorithmURI, contextNodes);
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to