Handle case were a Document is passed in.
authorcantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 8 Mar 2005 22:13:41 +0000 (22:13 +0000)
committercantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 8 Mar 2005 22:13:41 +0000 (22:13 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1272 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/serviceprovider/XMLMetadataImpl.java

index 89cd868..e9c60a4 100644 (file)
@@ -19,6 +19,7 @@ import org.apache.log4j.Logger;
 import org.apache.xmlbeans.XmlException;
 import org.opensaml.SAMLException;
 import org.opensaml.artifact.Artifact;
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -50,7 +51,10 @@ class XMLMetadataImpl
            try {
             // Assuming this just gets a DOM tree containing the metadata,
             // hopefully this will "just work".
-            realObject = new edu.internet2.middleware.shibboleth.metadata.provider.XMLMetadataProvider((Element)dom);
+            realObject =
+                new edu.internet2.middleware.shibboleth.metadata.provider.XMLMetadataProvider(
+                        (dom instanceof Element) ? (Element)dom : ((dom instanceof Document) ? ((Document)dom).getDocumentElement() : null)
+                    );
         }
         catch (SAMLException e) {
             throw new ShibbolethConfigurationException("Exception initializing metadata: " + e);