Fix null check and error message
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 27 Oct 2008 12:28:00 +0000 (12:28 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 27 Oct 2008 12:28:00 +0000 (12:28 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/branches/REL_2@2787 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/PreviousSessionLoginHandler.java

index 6601669..02cfece 100644 (file)
@@ -104,10 +104,12 @@ public class PreviousSessionLoginHandler extends AbstractLoginHandler {
         }
         
         Session idpSession = (Session) httpRequest.getAttribute(Session.HTTP_SESSION_BINDING_ATTRIBUTE);
-        if(idpSession != null){
+        if(idpSession == null){
             log.error("No existing IdP session available.");
+            httpRequest.setAttribute(LoginHandler.AUTHENTICATION_ERROR_KEY, "No existing IdP session available");
+        }else{
+            httpRequest.setAttribute(LoginHandler.PRINCIPAL_NAME_KEY, idpSession.getPrincipalName());
         }
-        httpRequest.setAttribute(LoginHandler.PRINCIPAL_NAME_KEY, idpSession.getPrincipalName());
 
         AuthenticationEngine.returnToAuthenticationEngine(httpRequest, httpResponse);
     }