~ubuntu-branches/ubuntu/precise/libxml-security-java/precise-security

« back to all changes in this revision

Viewing changes to src/org/apache/xml/security/transforms/Transform.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-08-30 14:07:46 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: package-import@ubuntu.com-20110830140746-wfmiluk1yddqd6ch
* New upstream release
* Update debian/watch to point to new SVN repo.
* Update Standards-Version: 3.9.1.
* Switch to source format 3.0.
* Use Maven to build the package. Ignore test failures.
* Update Description.
* Add a documentation package.
* Update Homepage field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 1999-2008 The Apache Software Foundation.
 
2
 * Copyright 1999-2009 The Apache Software Foundation.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
18
18
 
19
19
import java.io.IOException;
20
20
import java.io.OutputStream;
21
 
import java.security.AccessController;
22
 
import java.security.PrivilegedAction;
23
21
import java.util.HashMap;
24
22
import javax.xml.parsers.ParserConfigurationException;
25
23
 
28
26
import org.apache.xml.security.exceptions.AlgorithmAlreadyRegisteredException;
29
27
import org.apache.xml.security.exceptions.XMLSecurityException;
30
28
import org.apache.xml.security.signature.XMLSignatureInput;
 
29
import org.apache.xml.security.utils.ClassLoaderUtils;
31
30
import org.apache.xml.security.utils.Constants;
32
31
import org.apache.xml.security.utils.HelperNodeList;
33
32
import org.apache.xml.security.utils.SignatureElementProxy;
173
172
        Document doc, String algorithmURI, Element contextChild)
174
173
        throws InvalidTransformException {
175
174
 
176
 
        HelperNodeList contextNodes = new HelperNodeList();
177
 
 
178
 
        XMLUtils.addReturnToElement(doc, contextNodes);
179
 
        contextNodes.appendChild(contextChild);
180
 
        XMLUtils.addReturnToElement(doc, contextNodes);
 
175
        HelperNodeList contextNodes = null;
 
176
        
 
177
        if (contextChild != null) {
 
178
            contextNodes = new HelperNodeList();
 
179
    
 
180
            XMLUtils.addReturnToElement(doc, contextNodes);
 
181
            contextNodes.appendChild(contextChild);
 
182
            XMLUtils.addReturnToElement(doc, contextNodes);
 
183
        }
181
184
 
182
185
        return getInstance(doc, algorithmURI, contextNodes);
183
186
    }
232
235
               "algorithm.alreadyRegistered", exArgs);
233
236
        }
234
237
 
235
 
        ClassLoader cl = (ClassLoader) AccessController.doPrivileged(
236
 
            new PrivilegedAction() {
237
 
                public Object run() {
238
 
                    return Thread.currentThread().getContextClassLoader();
239
 
                }
240
 
            });
241
 
 
242
238
        try {
243
239
            transformClassHash.put
244
 
                (algorithmURI, Class.forName(implementingClass, true, cl));
 
240
                (algorithmURI, ClassLoaderUtils.loadClass(implementingClass, Transform.class));
245
241
        } catch (ClassNotFoundException e) {
246
242
            throw new RuntimeException(e);
247
243
        }