[java-opensaml COMMIT] in /trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util: SOAPConstants.java SOAPHelpe...

noreply at shibboleth.net noreply at shibboleth.net
Mon Jan 7 18:17:21 EST 2013


Author: scantor
Date: Mon Jan  7 18:17:21 2013
New Revision: 3136

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3136&view=rev
Log:
Annotations and constraints.

Added:
    trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/package-info.java   (with props)
Modified:
    trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPConstants.java
    trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPHelper.java
    trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/package.html

Modified: trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPConstants.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPConstants.java?rev=3136&r1=3135&r2=3136&view=diff
==============================================================================
--- trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPConstants.java (original)
+++ trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPConstants.java Mon Jan  7 18:17:21 2013
@@ -18,8 +18,8 @@
 package org.opensaml.soap.util;
 
 /** SOAP Related Constants. */
-public class SOAPConstants {
-
+public final class SOAPConstants {
+    
     /** SOAP 1.1 namespace. */
     public static final String SOAP11_NS = "http://schemas.xmlsoap.org/soap/envelope/";
 
@@ -31,4 +31,9 @@
 
     /** SOAP 1.2 prefix. */
     public static final String SOAP12_PREFIX = "soap12";
+
+    /** Constructor. */
+    private SOAPConstants() {
+        
+    }
 }

Modified: trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPHelper.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPHelper.java?rev=3136&r1=3135&r2=3136&view=diff
==============================================================================
--- trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPHelper.java (original)
+++ trunk/opensaml-soap-api/src/main/java/org/opensaml/soap/util/SOAPHelper.java Mon Jan  7 18:17:21 2013
@@ -24,9 +24,12 @@
 import java.util.Map.Entry;
 import java.util.Set;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import javax.xml.namespace.QName;
 
 import net.shibboleth.utilities.java.support.collection.LazyList;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.xml.XmlConstants;
 
@@ -67,7 +70,7 @@
      * @param soapObject the SOAP object to add the attribute to
      * @param mustUnderstand whether mustUnderstand is true or false
      */
-    public static void addSOAP11MustUnderstandAttribute(XMLObject soapObject, boolean mustUnderstand) {
+    public static void addSOAP11MustUnderstandAttribute(@Nonnull final XMLObject soapObject, boolean mustUnderstand) {
         if (soapObject instanceof MustUnderstandBearing) {
             ((MustUnderstandBearing) soapObject).setSOAP11MustUnderstand(new XSBooleanValue(mustUnderstand, true));
         } else if (soapObject instanceof AttributeExtensibleXMLObject) {
@@ -75,7 +78,8 @@
                     MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
                     new XSBooleanValue(mustUnderstand, true).toString());
         } else {
-            throw new IllegalArgumentException("Specified object was neither MustUnderBearing nor AttributeExtensible");
+            throw new IllegalArgumentException(
+                    "Specified object was neither MustUnderstandBearing nor AttributeExtensible");
         }
     }
 
@@ -86,7 +90,7 @@
      * 
      * @return value of the mustUnderstand attribute, or false if not present
      */
-    public static boolean getSOAP11MustUnderstandAttribute(XMLObject soapObject) {
+    public static boolean getSOAP11MustUnderstandAttribute(@Nonnull final XMLObject soapObject) {
         if (soapObject instanceof MustUnderstandBearing) {
             XSBooleanValue value = ((MustUnderstandBearing) soapObject).isSOAP11MustUnderstandXSBoolean();
             if (value != null) {
@@ -96,7 +100,7 @@
         if (soapObject instanceof AttributeExtensibleXMLObject) {
             String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
                     .getUnknownAttributes().get(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME));
-            return Objects.equal("1", value);
+            return Objects.equal("1", value) || Objects.equal("true", value);
         }
         return false;
     }
@@ -107,12 +111,13 @@
      * @param soapObject the SOAP object to add the attribute to
      * @param actorURI the URI of the actor
      */
-    public static void addSOAP11ActorAttribute(XMLObject soapObject, String actorURI) {
+    public static void addSOAP11ActorAttribute(@Nonnull final XMLObject soapObject, @Nonnull final String actorURI) {
+        String value = Constraint.isNotNull(StringSupport.trimOrNull(actorURI), "Actor URI cannot be null or empty");
         if (soapObject instanceof ActorBearing) {

[... 243 lines stripped ...]


More information about the commits mailing list