Fix NPE when message doesn't even manage to be decoded enough to construct a basic...
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 28 May 2008 07:59:40 +0000 (07:59 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 28 May 2008 07:59:40 +0000 (07:59 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/branches/REL_2@2735 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml1/AbstractSAML1ProfileHandler.java
src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/AbstractSAML2ProfileHandler.java

index 2ee59d1..9c5c2b7 100644 (file)
@@ -424,10 +424,13 @@ public abstract class AbstractSAML1ProfileHandler extends AbstractSAMLProfileHan
             ResponseAbstractType response) {
         response.setID(getIdGenerator().generateIdentifier());
 
-        SAMLObject samlMessage = requestContext.getInboundSAMLMessage();
-        if (samlMessage != null && samlMessage instanceof RequestAbstractType) {
-            response.setInResponseTo(((RequestAbstractType) samlMessage).getID());
+        if(requestContext != null){
+            SAMLObject samlMessage = requestContext.getInboundSAMLMessage();
+            if (samlMessage != null && samlMessage instanceof RequestAbstractType) {
+                response.setInResponseTo(((RequestAbstractType) samlMessage).getID());
+            }
         }
+        
         response.setVersion(SAMLVersion.VERSION_11);
     }
 
index 4a39a6c..2058da9 100644 (file)
@@ -402,9 +402,11 @@ public abstract class AbstractSAML2ProfileHandler extends AbstractSAMLProfileHan
     protected void populateStatusResponse(BaseSAML2ProfileRequestContext<?, ?, ?> requestContext,
             StatusResponseType response) {
         response.setID(getIdGenerator().generateIdentifier());
-        if (requestContext.getInboundSAMLMessage() != null) {
+        
+        if (requestContext != null && requestContext.getInboundSAMLMessage() != null) {
             response.setInResponseTo(requestContext.getInboundSAMLMessageId());
         }
+        
         response.setVersion(SAMLVersion.VERSION_20);
         response.setIssuer(buildEntityIssuer(requestContext));
     }