[java-opensaml COMMIT] in /trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact: AbstractS...

noreply at shibboleth.net noreply at shibboleth.net
Sun Jul 7 16:55:53 EDT 2013


Author: scantor
Date: Sun Jul  7 16:55:53 2013
New Revision: 3396

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3396&view=rev
Log:
Layer SAMLArtifactMap classes on storage API.

Added:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/package-info.java   (with props)
Modified:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/SAMLArtifactMap.java
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/package.html

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java?rev=3396&r1=3395&r2=3396&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java Sun Jul  7 16:55:53 2013
@@ -19,7 +19,11 @@
 
 import java.util.Arrays;
 
+import javax.annotation.Nonnull;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.codec.Base64Support;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.apache.commons.codec.binary.Hex;
 
@@ -38,7 +42,7 @@
      * 
      * @throws IllegalArgumentException thrown if the given type code is not two bytes in length
      */
-    protected AbstractSAMLArtifact(byte[] code) {
+    protected AbstractSAMLArtifact(@Nonnull final byte[] code) {
         if (code.length != 2) {
             throw new IllegalArgumentException("Type code was not 2-bytes in size");
         }
@@ -50,9 +54,9 @@
      * 
      * @return the bytes for the artifact
      */
-    public byte[] getArtifactBytes() {
-        byte[] remainingArtifact = getRemainingArtifact();
-        byte[] artifact = new byte[2 + remainingArtifact.length];
+    @Nonnull public byte[] getArtifactBytes() {
+        final byte[] remainingArtifact = getRemainingArtifact();
+        final byte[] artifact = new byte[2 + remainingArtifact.length];
 
         System.arraycopy(getTypeCode(), 0, artifact, 0, 2);
         System.arraycopy(remainingArtifact, 0, artifact, 2, remainingArtifact.length);
@@ -65,7 +69,7 @@
      * 
      * @return the type code for this artifact
      */
-    public byte[] getTypeCode() {
+    @Nonnull public byte[] getTypeCode() {
         return typeCode;
     }
 
@@ -74,8 +78,8 @@
      * 
      * @param newTypeCode 2 byte type code for this artifact
      */
-    protected void setTypeCode(byte[] newTypeCode) {
-        typeCode = newTypeCode;
+    protected void setTypeCode(@Nonnull final byte[] newTypeCode) {
+        typeCode = Constraint.isNotNull(newTypeCode, "Type code cannot be null");
     }
 
     /**
@@ -83,14 +87,14 @@
      * 
      * @return artifact bytes minus the type code
      */
-    public abstract byte[] getRemainingArtifact();
+    @Nonnull public abstract byte[] getRemainingArtifact();
 
     /**
      * Gets the Base64 encoded artifact.
      * 
      * @return Base64 encoded artifact.
      */
-    public String base64Encode() {
+    @Nonnull @NotEmpty public String base64Encode() {
         return Base64Support.encode(getArtifactBytes(), Base64Support.UNCHUNKED);
     }
 
@@ -99,7 +103,7 @@
      * 
      * @return hex encoded artifact
      */
-    public String hexEncode() {
+    @Nonnull @NotEmpty public String hexEncode() {
         return Hex.encodeHexString(getArtifactBytes());
     }
 

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/SAMLArtifactMap.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/SAMLArtifactMap.java?rev=3396&r1=3395&r2=3396&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/SAMLArtifactMap.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/SAMLArtifactMap.java Sun Jul  7 16:55:53 2013
@@ -17,35 +17,43 @@
 
 package org.opensaml.saml.common.binding.artifact;
 
-import org.opensaml.core.xml.io.MarshallingException;
+import java.io.IOException;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.component.DestructableComponent;
+import net.shibboleth.utilities.java.support.component.IdentifiableComponent;
+import net.shibboleth.utilities.java.support.component.InitializableComponent;
+import net.shibboleth.utilities.java.support.component.ValidatableComponent;
+

[... 144 lines stripped ...]


More information about the commits mailing list