[java-opensaml] branch main updated: Add some missing annotations, tighten up some APIs.
Scott Cantor
cantor.2 at osu.edu
Tue Mar 7 15:53:48 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=3102f6e8d29ffb91ddb024bbd10fd363637b00e5
The following commit(s) were added to refs/heads/main by this push:
new 3102f6e8d Add some missing annotations, tighten up some APIs.
3102f6e8d is described below
commit 3102f6e8d29ffb91ddb024bbd10fd363637b00e5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 7 10:53:45 2023 -0500
Add some missing annotations, tighten up some APIs.
---
.../opensaml/core/xml/XMLObjectBuilderFactory.java | 18 +++++++++-------
.../opensaml/core/xml/io/UnmarshallerFactory.java | 19 ++++++++--------
.../opensaml/core/xml/util/XMLObjectSupport.java | 18 ++++++++--------
.../StorageServiceSAMLArtifactMapEntryFactory.java | 2 +-
.../saml2cb/impl/ChannelBindingsUnmarshaller.java | 3 ++-
.../ext/samlec/impl/GeneratedKeyUnmarshaller.java | 4 +++-
.../ext/samlec/impl/SessionKeyUnmarshaller.java | 6 ++++--
.../saml2/ecp/impl/RelayStateUnmarshaller.java | 4 +++-
.../ecp/impl/RequestAuthenticatedUnmarshaller.java | 4 +++-
.../saml/saml2/ecp/impl/RequestUnmarshaller.java | 11 +++++-----
.../saml/saml2/ecp/impl/ResponseUnmarshaller.java | 4 +++-
.../ecp/impl/SubjectConfirmationUnmarshaller.java | 6 ++++--
.../impl/EncryptedHeaderUnmarshaller.java | 8 ++++---
.../core/testing/XMLObjectBaseTestCase.java | 25 +++++++++++-----------
.../impl/AttributeValueTypeUnmarshaller.java | 10 +++++----
.../impl/EncryptionPropertyUnmarshaller.java | 8 ++++---
16 files changed, 86 insertions(+), 64 deletions(-)
diff --git a/opensaml-core-api/src/main/java/org/opensaml/core/xml/XMLObjectBuilderFactory.java b/opensaml-core-api/src/main/java/org/opensaml/core/xml/XMLObjectBuilderFactory.java
index 8e636a647..54bfabd4c 100644
--- a/opensaml-core-api/src/main/java/org/opensaml/core/xml/XMLObjectBuilderFactory.java
+++ b/opensaml-core-api/src/main/java/org/opensaml/core/xml/XMLObjectBuilderFactory.java
@@ -17,7 +17,6 @@
package org.opensaml.core.xml;
-import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -27,6 +26,7 @@ import javax.xml.namespace.QName;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.xml.DOMTypeSupport;
import net.shibboleth.shared.xml.QNameSupport;
@@ -60,10 +60,7 @@ public class XMLObjectBuilderFactory {
*
* @return the builder, or null
*/
- @Nullable public XMLObjectBuilder<?> getBuilder(@Nullable final QName key) {
- if (key == null){
- return null;
- }
+ @Nullable public XMLObjectBuilder<?> getBuilder(@Nonnull final QName key) {
return builders.get(key);
}
@@ -75,9 +72,14 @@ public class XMLObjectBuilderFactory {
*
* @return the builder for the XMLObject the given element can be unmarshalled into, or null
*/
- @Nullable public XMLObjectBuilder<?> getBuilder(@Nullable final Element domElement) {
+ @Nullable public XMLObjectBuilder<?> getBuilder(@Nonnull final Element domElement) {
- XMLObjectBuilder<?> builder = getBuilder(DOMTypeSupport.getXSIType(domElement));
+ XMLObjectBuilder<?> builder = null;
+
+ final QName xsitype = DOMTypeSupport.getXSIType(domElement);
+ if (xsitype != null) {
+ builder = getBuilder(xsitype);
+ }
if (builder == null) {
builder = getBuilder(QNameSupport.getNodeQName(domElement));
@@ -135,7 +137,7 @@ public class XMLObjectBuilderFactory {
* @return list of all the builders currently registered
*/
@Nonnull @NotLive @Unmodifiable public Map<QName, XMLObjectBuilder<?>> getBuilders() {
- return Collections.unmodifiableMap(builders);
+ return CollectionSupport.copyToMap(builders);
}
/**
diff --git a/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/UnmarshallerFactory.java b/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/UnmarshallerFactory.java
index 5599ba200..f3e6867a2 100644
--- a/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/UnmarshallerFactory.java
+++ b/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/UnmarshallerFactory.java
@@ -17,7 +17,6 @@
package org.opensaml.core.xml.io;
-import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -25,6 +24,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.xml.namespace.QName;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.xml.DOMTypeSupport;
import net.shibboleth.shared.xml.QNameSupport;
@@ -61,11 +61,7 @@ public class UnmarshallerFactory {
*
* @return the Unmarshaller
*/
- @Nullable public Unmarshaller getUnmarshaller(@Nullable final QName key) {
- if (key == null) {
- return null;
- }
-
+ @Nullable public Unmarshaller getUnmarshaller(@Nonnull final QName key) {
return unmarshallers.get(key);
}
@@ -77,10 +73,13 @@ public class UnmarshallerFactory {
*
* @return the unmarshaller for the XMLObject the given element can be unmarshalled into
*/
- @Nullable public Unmarshaller getUnmarshaller(@Nullable final Element domElement) {
- Unmarshaller unmarshaller;
+ @Nullable public Unmarshaller getUnmarshaller(@Nonnull final Element domElement) {
+ Unmarshaller unmarshaller = null;
- unmarshaller = getUnmarshaller(DOMTypeSupport.getXSIType(domElement));
+ final QName xsitype = DOMTypeSupport.getXSIType(domElement);
+ if (xsitype != null) {
+ unmarshaller = getUnmarshaller(xsitype);
+ }
if (unmarshaller == null) {
unmarshaller = getUnmarshaller(QNameSupport.getNodeQName(domElement));
@@ -95,7 +94,7 @@ public class UnmarshallerFactory {
* @return a listing of all the Unmarshallers currently registered
*/
@Nonnull public Map<QName, Unmarshaller> getUnmarshallers() {
- return Collections.unmodifiableMap(unmarshallers);
+ return CollectionSupport.copyToMap(unmarshallers);
}
/**
diff --git a/opensaml-core-api/src/main/java/org/opensaml/core/xml/util/XMLObjectSupport.java b/opensaml-core-api/src/main/java/org/opensaml/core/xml/util/XMLObjectSupport.java
index c7bdf534f..d30100d88 100644
--- a/opensaml-core-api/src/main/java/org/opensaml/core/xml/util/XMLObjectSupport.java
+++ b/opensaml-core-api/src/main/java/org/opensaml/core/xml/util/XMLObjectSupport.java
@@ -460,7 +460,7 @@ public final class XMLObjectSupport {
* @param attributeMap the target AttributeMap
* @param attribute the target DOM Attr
*/
- public static void unmarshallToAttributeMap(final AttributeMap attributeMap, final Attr attribute) {
+ public static void unmarshallToAttributeMap(@Nonnull final AttributeMap attributeMap, @Nonnull final Attr attribute) {
final QName attribQName = QNameSupport.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(),
attribute.getPrefix());
attributeMap.put(attribQName, attribute.getValue());
@@ -476,7 +476,7 @@ public final class XMLObjectSupport {
* @return an XMLObject
* @throws XMLRuntimeException if the required builder can not be obtained
*/
- @Nonnull public static XMLObject buildXMLObject(final QName elementName) {
+ @Nonnull public static XMLObject buildXMLObject(@Nonnull final QName elementName) {
final XMLObjectBuilder<?> builder = getProviderRegistry().getBuilderFactory().getBuilderOrThrow(elementName);
return builder.buildObject(elementName);
}
@@ -489,7 +489,7 @@ public final class XMLObjectSupport {
* @return an XMLObject
* @throws XMLRuntimeException if the required builder can not be obtained
*/
- @Nonnull public static XMLObject buildXMLObject(final QName elementName, final QName typeName) {
+ @Nonnull public static XMLObject buildXMLObject(@Nonnull final QName elementName, @Nullable final QName typeName) {
final XMLObjectBuilder<?> builder = getProviderRegistry().getBuilderFactory().getBuilderOrThrow(elementName);
return builder.buildObject(elementName, typeName);
}
@@ -500,7 +500,7 @@ public final class XMLObjectSupport {
* @param typeOrName the element name or type
* @return an XMLObject builder, or null if no provider registered
*/
- @Nullable public static XMLObjectBuilder<?> getBuilder(final QName typeOrName) {
+ @Nullable public static XMLObjectBuilder<?> getBuilder(@Nonnull final QName typeOrName) {
return getProviderRegistry().getBuilderFactory().getBuilder(typeOrName);
}
@@ -510,7 +510,7 @@ public final class XMLObjectSupport {
* @param typeOrName the element name or type
* @return an XMLObject marshaller, or null if no provider registered
*/
- @Nullable public static Marshaller getMarshaller(final QName typeOrName) {
+ @Nullable public static Marshaller getMarshaller(@Nonnull final QName typeOrName) {
return getProviderRegistry().getMarshallerFactory().getMarshaller(typeOrName);
}
@@ -520,7 +520,7 @@ public final class XMLObjectSupport {
* @param xmlObject the XMLObject to be marshalled
* @return an XMLObject marshaller, or null if no provider registered
*/
- @Nullable public static Marshaller getMarshaller(final XMLObject xmlObject) {
+ @Nullable public static Marshaller getMarshaller(@Nonnull final XMLObject xmlObject) {
return getProviderRegistry().getMarshallerFactory().getMarshaller(xmlObject);
}
@@ -530,17 +530,17 @@ public final class XMLObjectSupport {
* @param typeOrName the element name or type
* @return an XMLObject unmarshaller, or null if no provider registered
*/
- @Nullable public static Unmarshaller getUnmarshaller(final QName typeOrName) {
+ @Nullable public static Unmarshaller getUnmarshaller(@Nonnull final QName typeOrName) {
return getProviderRegistry().getUnmarshallerFactory().getUnmarshaller(typeOrName);
}
/**
- * Obtain an XMLObject unmarshaller for the given DOM Element.
+ * Obtain an XMLObject unmarshaller for the given DOM Element.
*
* @param element the DOM element
* @return an XMLObject unmarshaller, or null if no provider registered
*/
- @Nullable public static Unmarshaller getUnmarshaller(final Element element) {
+ @Nullable public static Unmarshaller getUnmarshaller(@Nonnull final Element element) {
return getProviderRegistry().getUnmarshallerFactory().getUnmarshaller(element);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/artifact/impl/StorageServiceSAMLArtifactMapEntryFactory.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/artifact/impl/StorageServiceSAMLArtifactMapEntryFactory.java
index c0959612c..4b30c5128 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/artifact/impl/StorageServiceSAMLArtifactMapEntryFactory.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/artifact/impl/StorageServiceSAMLArtifactMapEntryFactory.java
@@ -160,7 +160,7 @@ public class StorageServiceSAMLArtifactMapEntryFactory extends AbstractInitializ
throw new IOException("SAMLArtifactMapEntry XML missing issuer or relyingParty attributes");
}
- final Unmarshaller unmarshaller = XMLObjectSupport.getUnmarshaller((Element) rootElement.getFirstChild());
+ final Unmarshaller unmarshaller = XMLObjectSupport.getUnmarshaller((Element) messageElement);
if (unmarshaller == null) {
throw new UnmarshallingException("Unable to obtain unmarshaller for element "
+ QNameSupport.getNodeQName(rootElement.getFirstChild()));
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2cb/impl/ChannelBindingsUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2cb/impl/ChannelBindingsUnmarshaller.java
index 198d58780..64385259b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2cb/impl/ChannelBindingsUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/saml2cb/impl/ChannelBindingsUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.ext.saml2cb.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -34,7 +35,7 @@ import net.shibboleth.shared.xml.QNameSupport;
public class ChannelBindingsUnmarshaller extends XSBase64BinaryUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject xmlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute) throws UnmarshallingException {
final ChannelBindings cb = (ChannelBindings) xmlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/GeneratedKeyUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/GeneratedKeyUnmarshaller.java
index 663a7b40f..2e222d8a8 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/GeneratedKeyUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/GeneratedKeyUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.ext.samlec.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -34,7 +35,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class GeneratedKeyUnmarshaller extends XSBase64BinaryUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject samlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final GeneratedKey key = (GeneratedKey) samlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/SessionKeyUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/SessionKeyUnmarshaller.java
index 101d9b816..378a9531b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/SessionKeyUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/ext/samlec/impl/SessionKeyUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.ext.samlec.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -36,7 +37,7 @@ import net.shibboleth.shared.xml.QNameSupport;
public class SessionKeyUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/** {@inheritDoc} */
- protected void processChildElement(final XMLObject parentObject, final XMLObject childObject)
+ protected void processChildElement(@Nonnull final XMLObject parentObject, @Nonnull final XMLObject childObject)
throws UnmarshallingException {
final SessionKey key = (SessionKey) parentObject;
@@ -50,7 +51,8 @@ public class SessionKeyUnmarshaller extends AbstractSAMLObjectUnmarshaller {
}
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject samlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final SessionKey key = (SessionKey) samlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateUnmarshaller.java
index a1bca4a11..16dd9b478 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.saml2.ecp.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -34,7 +35,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class RelayStateUnmarshaller extends XSStringUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject xmlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final RelayState relayState = (RelayState) xmlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedUnmarshaller.java
index 1fb868955..2f1825093 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.saml2.ecp.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -34,7 +35,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class RequestAuthenticatedUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject xmlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final RequestAuthenticated ra = (RequestAuthenticated) xmlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestUnmarshaller.java
index 69982094c..1e726d265 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.saml2.ecp.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -36,7 +37,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class RequestUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject samlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final Request request = (Request) samlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
@@ -54,8 +56,8 @@ public class RequestUnmarshaller extends AbstractSAMLObjectUnmarshaller {
}
/** {@inheritDoc} */
- protected void processChildElement(final XMLObject parentSAMLObject, final XMLObject childSAMLObject)
- throws UnmarshallingException {
+ protected void processChildElement(@Nonnull final XMLObject parentSAMLObject,
+ @Nonnull final XMLObject childSAMLObject) throws UnmarshallingException {
final Request request = (Request) parentSAMLObject;
if (childSAMLObject instanceof Issuer) {
@@ -67,5 +69,4 @@ public class RequestUnmarshaller extends AbstractSAMLObjectUnmarshaller {
}
}
-
-}
+}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseUnmarshaller.java
index 988a00234..16f4a5920 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.saml2.ecp.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -34,7 +35,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class ResponseUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject samlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final Response response = (Response) samlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationUnmarshaller.java
index 34f2b41ba..29c01bf75 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.saml2.ecp.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -35,7 +36,7 @@ import net.shibboleth.shared.xml.QNameSupport;
public class SubjectConfirmationUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/** {@inheritDoc} */
- protected void processChildElement(final XMLObject parentObject, final XMLObject childObject)
+ protected void processChildElement(@Nonnull final XMLObject parentObject, @Nonnull final XMLObject childObject)
throws UnmarshallingException {
final SubjectConfirmation sc = (SubjectConfirmation) parentObject;
@@ -47,7 +48,8 @@ public class SubjectConfirmationUnmarshaller extends AbstractSAMLObjectUnmarshal
}
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject samlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final SubjectConfirmation sc = (SubjectConfirmation) samlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
diff --git a/opensaml-soap-impl/src/main/java/org/opensaml/soap/wssecurity/impl/EncryptedHeaderUnmarshaller.java b/opensaml-soap-impl/src/main/java/org/opensaml/soap/wssecurity/impl/EncryptedHeaderUnmarshaller.java
index b3fb94a4c..c00da393f 100644
--- a/opensaml-soap-impl/src/main/java/org/opensaml/soap/wssecurity/impl/EncryptedHeaderUnmarshaller.java
+++ b/opensaml-soap-impl/src/main/java/org/opensaml/soap/wssecurity/impl/EncryptedHeaderUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.soap.wssecurity.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -34,7 +35,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class EncryptedHeaderUnmarshaller extends AbstractWSSecurityObjectUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject xmlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final EncryptedHeader eh = (EncryptedHeader) xmlObject;
final QName attrName = QNameSupport.getNodeQName(attribute);
if (EncryptedHeader.WSU_ID_ATTR_NAME.equals(attrName)) {
@@ -56,8 +58,8 @@ public class EncryptedHeaderUnmarshaller extends AbstractWSSecurityObjectUnmarsh
}
/** {@inheritDoc} */
- protected void processChildElement(final XMLObject parentXMLObject, final XMLObject childXMLObject)
- throws UnmarshallingException {
+ protected void processChildElement(@Nonnull final XMLObject parentXMLObject,
+ @Nonnull final XMLObject childXMLObject) throws UnmarshallingException {
final EncryptedHeader eh = (EncryptedHeader) parentXMLObject;
if (childXMLObject instanceof EncryptedData) {
eh.setEncryptedData((EncryptedData) childXMLObject);
diff --git a/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java b/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java
index 659771bb6..d3ace77ca 100644
--- a/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java
+++ b/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java
@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.xml.namespace.QName;
@@ -136,7 +137,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
*
* @return the built XMLObject
*/
- protected <T extends XMLObject> T buildXMLObject(QName name) {
+ protected <T extends XMLObject> T buildXMLObject(@Nonnull final QName name) {
final XMLObjectBuilder<T> builder = getBuilder(name);
if (builder == null) {
Assert.fail("no builder registered for: " + name);
@@ -154,7 +155,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
*
* @return the XMLObject from the file
*/
- @Nullable protected <T extends XMLObject> T unmarshallElement(String elementFile) {
+ @Nullable protected <T extends XMLObject> T unmarshallElement(@Nonnull final String elementFile) {
try {
return unmarshallElement(elementFile, false);
} catch (XMLParserException | UnmarshallingException e) {
@@ -176,7 +177,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @throws XMLParserException ...
* @throws UnmarshallingException ...
*/
- @Nullable protected <T extends XMLObject> T unmarshallElement(String elementFile, boolean propagateErrors)
+ @Nullable protected <T extends XMLObject> T unmarshallElement(@Nonnull final String elementFile, boolean propagateErrors)
throws XMLParserException, UnmarshallingException {
try {
final Document doc = parseXMLDocument(elementFile);
@@ -207,7 +208,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param node node to print
* @param filename name of file to print to
*/
- protected void printXML(Node node, String filename) {
+ protected void printXML(@Nonnull final Node node, @Nonnull final String filename) {
try {
SerializeSupport.writeNode(node, new FileOutputStream(new File(filename)));
} catch (IOException e) {
@@ -222,7 +223,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param xmlObject {@link XMLObject} to print
* @param filename name of file to print to
*/
- protected void printXML(XMLObject xmlObject, String filename) {
+ protected void printXML(@Nonnull final XMLObject xmlObject, @Nonnull final String filename) {
Element elem = null;
try {
elem = marshallerFactory.getMarshaller(xmlObject).marshall(xmlObject);
@@ -240,7 +241,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
*
* @return the XMLObjectBuilder
*/
- protected <T extends XMLObject> XMLObjectBuilder<T> getBuilder(QName qname) {
+ protected <T extends XMLObject> XMLObjectBuilder<T> getBuilder(@Nonnull final QName qname) {
return builderFactory.getBuilderOrThrow(qname);
}
@@ -250,7 +251,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param qname the QName for which to find the marshaller
* @return the marshaller
*/
- protected Marshaller getMarshaller(QName qname) {
+ protected Marshaller getMarshaller(@Nonnull final QName qname) {
Marshaller marshaller = marshallerFactory.getMarshaller(qname);
if (marshaller == null) {
Assert.fail("no marshaller registered for " + qname);
@@ -264,7 +265,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param xmlObject the XMLObject for which to find the marshaller
* @return the marshaller
*/
- protected Marshaller getMarshaller(XMLObject xmlObject) {
+ protected Marshaller getMarshaller(@Nonnull final XMLObject xmlObject) {
Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
if (marshaller == null) {
Assert.fail("no marshaller registered for " + xmlObject.getClass().getName());
@@ -278,7 +279,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param qname the QName for which to find the unmarshaller
* @return the unmarshaller
*/
- protected Unmarshaller getUnmarshaller(QName qname) {
+ protected Unmarshaller getUnmarshaller(@Nonnull final QName qname) {
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(qname);
if (unmarshaller == null) {
Assert.fail("no unmarshaller registered for " + qname);
@@ -292,7 +293,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param xmlObject the XMLObject for which to find the unmarshaller
* @return the unmarshaller
*/
- protected Unmarshaller getUnmarshaller(XMLObject xmlObject) {
+ protected Unmarshaller getUnmarshaller(@Nonnull final XMLObject xmlObject) {
return getUnmarshaller(xmlObject.getElementQName());
}
@@ -302,7 +303,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param element the Element for which to find the unmarshaller
* @return the unmarshaller
*/
- protected Unmarshaller getUnmarshaller(Element element) {
+ protected Unmarshaller getUnmarshaller(@Nonnull final Element element) {
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
if (unmarshaller == null) {
Assert.fail("no unmarshaller registered for " + QNameSupport.getNodeQName(element));
@@ -317,7 +318,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @return the parsed Document
* @throws XMLParserException if parsing did not succeed
*/
- protected Document parseXMLDocument(String xmlFilename) throws XMLParserException {
+ protected Document parseXMLDocument(@Nonnull final String xmlFilename) throws XMLParserException {
InputStream is = getClass().getResourceAsStream(xmlFilename);
Document doc = parserPool.parse(is);
return doc;
diff --git a/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/policy/impl/AttributeValueTypeUnmarshaller.java b/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/policy/impl/AttributeValueTypeUnmarshaller.java
index df37ba5f7..0d44bcffb 100644
--- a/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/policy/impl/AttributeValueTypeUnmarshaller.java
+++ b/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/policy/impl/AttributeValueTypeUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.xacml.policy.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import net.shibboleth.shared.primitive.StringSupport;
@@ -33,7 +34,8 @@ public class AttributeValueTypeUnmarshaller extends AbstractXACMLObjectUnmarshal
/** {@inheritDoc} */
@Override
- protected void processAttribute(final XMLObject xmlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final AttributeValueType attributeValue = (AttributeValueType) xmlObject;
final QName attribQName = QNameSupport.getNodeQName(attribute);
@@ -51,15 +53,15 @@ public class AttributeValueTypeUnmarshaller extends AbstractXACMLObjectUnmarshal
/** {@inheritDoc} */
@Override
- protected void processChildElement(final XMLObject parentXMLObject, final XMLObject childXMLObject)
- throws UnmarshallingException {
+ protected void processChildElement(@Nonnull final XMLObject parentXMLObject,
+ @Nonnull final XMLObject childXMLObject) throws UnmarshallingException {
final AttributeValueType attributeValue = (AttributeValueType) parentXMLObject;
attributeValue.getUnknownXMLObjects().add(childXMLObject);
}
/** {@inheritDoc} */
@Override
- protected void processElementContent(final XMLObject xmlObject, final String elementContent) {
+ protected void processElementContent(@Nonnull final XMLObject xmlObject, @Nonnull final String elementContent) {
final AttributeValueType attributeValue = (AttributeValueType) xmlObject;
attributeValue.setValue(elementContent);
}
diff --git a/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/encryption/impl/EncryptionPropertyUnmarshaller.java b/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/encryption/impl/EncryptionPropertyUnmarshaller.java
index 76b37dd60..7b93e415e 100644
--- a/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/encryption/impl/EncryptionPropertyUnmarshaller.java
+++ b/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/encryption/impl/EncryptionPropertyUnmarshaller.java
@@ -17,6 +17,7 @@
package org.opensaml.xmlsec.encryption.impl;
+import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -32,7 +33,8 @@ import net.shibboleth.shared.xml.QNameSupport;
public class EncryptionPropertyUnmarshaller extends AbstractXMLEncryptionUnmarshaller {
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject xmlObject, final Attr attribute) throws UnmarshallingException {
+ protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final EncryptionProperty ep = (EncryptionProperty) xmlObject;
if (attribute.getLocalName().equals(EncryptionProperty.ID_ATTRIB_NAME)) {
@@ -50,8 +52,8 @@ public class EncryptionPropertyUnmarshaller extends AbstractXMLEncryptionUnmarsh
}
/** {@inheritDoc} */
- protected void processChildElement(final XMLObject parentXMLObject, final XMLObject childXMLObject)
- throws UnmarshallingException {
+ protected void processChildElement(@Nonnull final XMLObject parentXMLObject,
+ @Nonnull final XMLObject childXMLObject) throws UnmarshallingException {
final EncryptionProperty ep = (EncryptionProperty) parentXMLObject;
// <any> content model
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list