[jboss-cvs] JBossAS SVN: r101128 - trunk/varia/src/main/java/org/jboss/security/srp/jaas.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 18 12:42:24 EST 2010
Author: david.lloyd at jboss.com
Date: 2010-02-18 12:42:24 -0500 (Thu, 18 Feb 2010)
New Revision: 101128
Modified:
trunk/varia/src/main/java/org/jboss/security/srp/jaas/SRPLoginModule.java
Log:
Either log the exception or rethrow, not both
Modified: trunk/varia/src/main/java/org/jboss/security/srp/jaas/SRPLoginModule.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/security/srp/jaas/SRPLoginModule.java 2010-02-18 17:17:40 UTC (rev 101127)
+++ trunk/varia/src/main/java/org/jboss/security/srp/jaas/SRPLoginModule.java 2010-02-18 17:42:24 UTC (rev 101128)
@@ -247,8 +247,10 @@
}
catch(Exception e)
{
- log.warn("Failed to complete SRP login", e);
- throw new LoginException("Failed to complete SRP login, msg="+e.getMessage());
+ if (e instanceof LoginException) throw (LoginException) e;
+ final LoginException loginException = new LoginException("Failed to complete SRP login (" + e.getMessage() + ")");
+ loginException.initCause(e);
+ throw loginException;
}
if( trace )
@@ -324,7 +326,10 @@
}
catch(Exception e)
{
- throw new LoginException("Failed to remove user principal, "+e.getMessage());
+ if (e instanceof LoginException) throw (LoginException) e;
+ final LoginException loginException = new LoginException("Failed to remove user principal (" + e.getMessage() + ")");
+ loginException.initCause(e);
+ throw loginException;
}
return true;
}
@@ -385,11 +390,15 @@
}
catch(java.io.IOException e)
{
- throw new LoginException(e.toString());
+ final LoginException loginException = new LoginException(e.toString());
+ loginException.initCause(e);
+ throw loginException;
}
catch(UnsupportedCallbackException uce)
{
- throw new LoginException("UnsupportedCallback: " + uce.getCallback().toString());
+ final LoginException loginException = new LoginException("UnsupportedCallback: " + uce.getCallback().toString());
+ loginException.initCause(uce);
+ throw loginException;
}
}
@@ -439,8 +448,10 @@
}
catch(Exception e)
{
- log.error("Failed to encrypt aux challenge", e);
- throw new LoginException("Failed to encrypt aux challenge");
+ if (e instanceof LoginException) throw (LoginException) e;
+ final LoginException loginException = new LoginException("Failed to encrypt aux challenge");
+ loginException.initCause(e);
+ throw loginException;
}
return sealedObject;
}
@@ -458,8 +469,10 @@
}
catch(Exception e)
{
- log.error("Failed to create SecretKey", e);
- throw new LoginException("Failed to create SecretKey");
+ if (e instanceof LoginException) throw (LoginException) e;
+ final LoginException loginException = new LoginException("Failed to create SecretKey");
+ loginException.initCause(e);
+ throw loginException;
}
return secretKey;
}
More information about the jboss-cvs-commits
mailing list