You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2020/05/11 08:09:57 UTC

svn commit: r1877569 - in /santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security: keys/ keys/keyresolver/implementations/ stax/config/

Author: coheigea
Date: Mon May 11 08:09:57 2020
New Revision: 1877569

URL: http://svn.apache.org/viewvc?rev=1877569&view=rev
Log:
Some refactoring of the keys package

Removed:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/ContentHandlerAlreadyRegisteredException.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/KeyUtils.java
Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RetrievalMethodResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RetrievalMethodResolver.java?rev=1877569&r1=1877568&r2=1877569&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RetrievalMethodResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RetrievalMethodResolver.java Mon May 11 08:09:57 2020
@@ -89,30 +89,30 @@ public class RetrievalMethodResolver ext
                     return cert.getPublicKey();
                 }
                 return null;
-             }
-             Element e = obtainReferenceElement(resource, secureValidation);
+            }
+            Element e = obtainReferenceElement(resource, secureValidation);
 
-             // Check to make sure that the reference is not to another RetrievalMethod
-             // which points to this element
-             if (XMLUtils.elementIsInSignatureSpace(e, Constants._TAG_RETRIEVALMETHOD)) {
-                 if (secureValidation) {
-                     if (LOG.isDebugEnabled()) {
-                         String error = "Error: It is forbidden to have one RetrievalMethod "
-                             + "point to another with secure validation";
-                         LOG.debug(error);
-                     }
-                     return null;
-                 }
-                 RetrievalMethod rm2 = new RetrievalMethod(e, baseURI);
-                 XMLSignatureInput resource2 = resolveInput(rm2, baseURI, secureValidation);
-                 Element e2 = obtainReferenceElement(resource2, secureValidation);
-                 if (e2 == element) {
-                     LOG.debug("Error: Can't have RetrievalMethods pointing to each other");
-                     return null;
-                 }
-             }
+            // Check to make sure that the reference is not to another RetrievalMethod
+            // which points to this element
+            if (XMLUtils.elementIsInSignatureSpace(e, Constants._TAG_RETRIEVALMETHOD)) {
+                if (secureValidation) {
+                    if (LOG.isDebugEnabled()) {
+                        String error = "Error: It is forbidden to have one RetrievalMethod "
+                                + "point to another with secure validation";
+                        LOG.debug(error);
+                    }
+                    return null;
+                }
+                RetrievalMethod rm2 = new RetrievalMethod(e, baseURI);
+                XMLSignatureInput resource2 = resolveInput(rm2, baseURI, secureValidation);
+                Element e2 = obtainReferenceElement(resource2, secureValidation);
+                if (e2 == element) {
+                    LOG.debug("Error: Can't have RetrievalMethods pointing to each other");
+                    return null;
+                }
+            }
 
-             return resolveKey(e, baseURI, storage, secureValidation);
+            return resolveKey(e, baseURI, storage, secureValidation);
          } catch (XMLSecurityException ex) {
              LOG.debug("XMLSecurityException", ex);
          } catch (CertificateException ex) {

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java?rev=1877569&r1=1877568&r2=1877569&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java Mon May 11 08:09:57 2020
@@ -68,10 +68,10 @@ public class XIncludeHandler extends Def
     private URL systemId;
     private boolean skipEvents = false;
 
-    Map<URI, Document> uriDocMap = new HashMap<>();
+    private final Map<URI, Document> uriDocMap;
 
     public XIncludeHandler(ContentHandler contentHandler) {
-        this.contentHandler = contentHandler;
+        this(contentHandler, new HashMap<>());
     }
 
     private XIncludeHandler(ContentHandler contentHandler, Map<URI, Document> uriDocMap) {