[java-opensaml] branch master updated: JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)

Phil Smart philip.smart at jisc.ac.uk
Wed Feb 12 09:29:47 EST 2020


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch master
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=0908964efec39d268fd30791757511625991b186

The following commit(s) were added to refs/heads/master by this push:
       new  0908964   JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)
0908964 is described below

commit 0908964efec39d268fd30791757511625991b186
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Feb 12 14:29:24 2020 +0000

    JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)
    
     - return empty string when base64 encoding of SAML artifact in toString fails.
    
    https://issues.shibboleth.net/jira/browse/JSPT-93
---
 .../saml/common/binding/artifact/AbstractSAMLArtifact.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java
index 10d2582..206bfe4 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/artifact/AbstractSAMLArtifact.java
@@ -27,11 +27,16 @@ import net.shibboleth.utilities.java.support.codec.EncodingException;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.apache.commons.codec.binary.Hex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Base class for SAML artifacts.
  */
 public abstract class AbstractSAMLArtifact implements SAMLArtifact {
+    
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractSAMLArtifact.class);
 
     /** 2 byte artifact type code. */
     private byte[] typeCode;
@@ -125,9 +130,8 @@ public abstract class AbstractSAMLArtifact implements SAMLArtifact {
         try {
             return base64Encode();
         } catch (final EncodingException e) {
-            //very unlikely.
-            //TODO: not clear this is the right thing to do here. could throw RT exception.
-            return e.getMessage()!=null ? this.getClass().getSimpleName()+"#toString() threw "+e.getMessage(): "";
+            log.warn("Could not base64 encode SAML artifact for toString representation: {}",e.getMessage());
+            return "";
         }
     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list