Bug 47762 - contextChild parameter of Transform.getInstance may be null
Summary: contextChild parameter of Transform.getInstance may be null
Status: RESOLVED FIXED
Alias: None
Product: Security - Now in JIRA
Classification: Unclassified
Component: Signature (show other bugs)
Version: Java 1.4.2
Hardware: PC All
: P2 trivial
Target Milestone: ---
Assignee: XML Security Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-28 11:16 UTC by Julien Pasquier
Modified: 2009-08-31 04:08 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Pasquier 2009-08-28 11:16:37 UTC
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);
}
Comment 1 coheigea 2009-08-31 04:08:52 UTC
Fix applied.

Colm.