[jboss-cvs] Picketbox SVN: r276 - in trunk: picketbox/src/main/java/org/picketbox/factories and 47 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 28 19:19:54 EDT 2011


Author: anil.saldhana at jboss.com
Date: 2011-10-28 19:19:53 -0400 (Fri, 28 Oct 2011)
New Revision: 276

Added:
   trunk/security-spi/identity/src/main/java/org/jboss/security/ErrorCodes.java
Modified:
   trunk/picketbox-infinispan/src/main/java/org/jboss/security/authentication/JBossCachedAuthenticationManager.java
   trunk/picketbox/src/main/java/org/picketbox/config/PicketBoxConfiguration.java
   trunk/picketbox/src/main/java/org/picketbox/factories/SecurityFactory.java
   trunk/picketbox/src/main/java/org/picketbox/plugins/PicketBoxProcessor.java
   trunk/picketbox/src/main/java/org/picketbox/sandbox/PBSandbox.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLProviderImpl.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/EntitlementEntry.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/RoleBasedACLProviderImpl.java
   trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/Util.java
   trunk/security-jboss-sx/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAInterleave.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAReverseInterleave.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AltClientLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AppPolicy.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Base64Utils.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/JBossJSSESecurityDomain.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/NestableGroup.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/RunAsIdentity.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/SecurityUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Util.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/AppCallbackHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/ConsoleInputHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/DigestCallbackHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JASPICallbackHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JBossCallbackHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/RFC2617Digest.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/SecurityAssociationHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/UsernamePasswordHandler.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntry.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/DelegatingServerAuthModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/HttpServletServerAuthModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/SimpleClientAuthModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JASPIAuthenticationInfo.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackHolder.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigFactory.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthConfig.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthContext.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthConfig.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthContext.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/BaseCertLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/CertRolesLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapUsersLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/ProxyLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/RoleMappingLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsernamePasswordLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersRolesLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/XMLLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/AbstractAuthorizationModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBJACCPolicyModuleDelegate.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBPolicyModuleDelegate.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLPolicyModuleDelegate.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebJACCPolicyModuleDelegate.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLPolicyModuleDelegate.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/util/JBossXACMLUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/cache/JBossAuthenticationCache.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/client/JBossSecurityClient.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/SecurityConfiguration.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ApplicationPolicyParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationConfigParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/JavaPropertiesConfigParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ModuleOptionParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxBasedConfigParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxParserUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/JBossIdentityTrustContext.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/DelegatingPolicy.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/JBossPolicyConfiguration.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/MappingProviderUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/LdapAttributeMappingProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectCNMapper.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectDNMapper.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/DatabaseRolesMappingProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/LdapRolesMappingProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/PropertiesRolesMappingProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/SimpleRolesMappingProvider.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/Util.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/DefaultLoginConfig.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContext.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContextUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecuritySubjectFactory.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JaasSecurityManagerBase.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/authorization/JBossAuthorizationContext.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/identitytrust/JBossIdentityTrustManager.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/EJBAuthorizationHelper.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/WebAuthorizationHelper.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/state/xml/StateMachineParser.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/xml/DOMUtils.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/CallerIdentityLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/ConfiguredIdentityLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/JaasSecurityDomainIdentityLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/PBEIdentityLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/SecureIdentityLoginModule.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/plugins/vault/PicketBoxSecurityVault.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/KeyStoreUtil.java
   trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/StringUtil.java
   trunk/security-spi/authorization/src/main/java/org/jboss/security/config/ControlFlag.java
   trunk/security-spi/identity/src/main/java/org/jboss/security/identity/IdentityFactory.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextAssociation.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextFactory.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/SubjectInfo.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/client/SecurityClientFactory.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/AbstractJavaEEHelper.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/EJBAuthenticationHelper.java
   trunk/security-spi/spi/src/main/java/org/jboss/security/vault/SecurityVaultFactory.java
Log:
SECURITY-609: error codes for exception messages

Modified: trunk/picketbox/src/main/java/org/picketbox/config/PicketBoxConfiguration.java
===================================================================
--- trunk/picketbox/src/main/java/org/picketbox/config/PicketBoxConfiguration.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/picketbox/src/main/java/org/picketbox/config/PicketBoxConfiguration.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import javax.xml.stream.XMLStreamException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.config.parser.StaxBasedConfigParser;
 import org.picketbox.exceptions.ConfigurationFileNullException;
 import org.picketbox.exceptions.ConfigurationParsingException;
@@ -52,7 +53,7 @@
    public void load(String configFileName) throws ConfigurationFileNullException, ConfigurationParsingException
    {
       if(configFileName == null)
-         throw new ConfigurationFileNullException("configFileName is null");
+         throw new ConfigurationFileNullException(ErrorCodes.NULL_ARGUMENT + "configFileName is null");
       InputStream configStream = loadStream(configFileName);
       load(configStream);   
    }
@@ -66,7 +67,7 @@
    public void load(InputStream configStream) throws ConfigurationStreamNullException, ConfigurationParsingException
    {
       if(configStream == null)
-         throw new ConfigurationStreamNullException("configStream is null");
+         throw new ConfigurationStreamNullException(ErrorCodes.NULL_ARGUMENT + "configStream is null");
       
       //Parser will parse the stream and update the JAAS Configuration 
       // set on JDK Configuration.getConfiguration and is an instance of ApplicationPolicyRegistration

Modified: trunk/picketbox/src/main/java/org/picketbox/factories/SecurityFactory.java
===================================================================
--- trunk/picketbox/src/main/java/org/picketbox/factories/SecurityFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/picketbox/src/main/java/org/picketbox/factories/SecurityFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,7 @@
 
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.ISecurityManagement;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityContextFactory;
@@ -55,13 +56,14 @@
       {
          ClassLoader tcl = SecurityActions.getContextClassLoader();
          if( tcl == null )
-            throw new IllegalStateException( "TCCL has not been set" );
+            throw new IllegalStateException( ErrorCodes.NULL_VALUE + "TCCL has not been set" );
          URL configLocation = tcl.getResource("auth.conf");
          String prop = "java.security.auth.login.config";
          if(SecurityActions.getSystemProperty(prop, null) == null)
          {
             if( configLocation == null )
-               throw new RuntimeException( "Neither system property *java.security.auth.login.config* available or auth.conf present" );
+               throw new RuntimeException( ErrorCodes.NULL_VALUE + 
+            		   "Neither system property *java.security.auth.login.config* available or auth.conf present" );
 
             SecurityActions.setSystemProperty(prop, configLocation.toExternalForm());  
          }
@@ -70,7 +72,7 @@
       }
       catch(Exception e)
       {
-         throw new RuntimeException("Unable to init SecurityFactory:", e);
+         throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "Unable to init SecurityFactory:", e);
       }
    }
    

Modified: trunk/picketbox/src/main/java/org/picketbox/plugins/PicketBoxProcessor.java
===================================================================
--- trunk/picketbox/src/main/java/org/picketbox/plugins/PicketBoxProcessor.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/picketbox/src/main/java/org/picketbox/plugins/PicketBoxProcessor.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -38,6 +38,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SimplePrincipal;
@@ -201,7 +202,7 @@
          Authentication authenticationAnnotation = objectClass.getAnnotation(Authentication.class);
          
          if(securityConfig == null && authenticationAnnotation == null)
-            throw new RuntimeException("@SecurityConfig or @Authentication is needed");
+            throw new RuntimeException(ErrorCodes.NULL_VALUE + "@SecurityConfig or @Authentication is needed");
          
          if(securityConfig != null)
          { 
@@ -258,7 +259,7 @@
          Subject subject = new Subject();
          boolean valid = authMgr.isValid(principal, credential, subject);
          if(!valid)
-            throw new LoginException("Invalid");
+            throw new LoginException(ErrorCodes.ACCESS_DENIED + "Invalid");
          
          SecurityActions.register(securityContext, principal, credential, subject); 
 
@@ -269,13 +270,13 @@
          //apply the role mapping logic if it is configured at the security domain level
          RoleGroup roles = authzMgr.getSubjectRoles(subject, cbh); 
          if(roles == null)
-            throw new PicketBoxProcessingException("Roles from subject is null");     
+            throw new PicketBoxProcessingException(ErrorCodes.NULL_VALUE + "Roles from subject is null");     
          
          if(needAuthorization)
          {
             int permit =  authzMgr.authorize(new POJOResource(pojo), subject, roles);
             if(permit != AuthorizationContext.PERMIT)
-               throw new AuthorizationException("Authorization failed"); 
+               throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "Authorization failed"); 
          }
       }
       catch(PrivilegedActionException pae)

Modified: trunk/picketbox/src/main/java/org/picketbox/sandbox/PBSandbox.java
===================================================================
--- trunk/picketbox/src/main/java/org/picketbox/sandbox/PBSandbox.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/picketbox/src/main/java/org/picketbox/sandbox/PBSandbox.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.Resource;
 import org.jboss.security.authorization.ResourceType;
@@ -72,7 +73,7 @@
 
          AuthenticationManager am = SecurityFactory.getAuthenticationManager(securityDomainName);
          if(am == null)
-            throw new RuntimeException("Authentication Manager is null"); 
+            throw new RuntimeException(ErrorCodes.NULL_VALUE + "Authentication Manager is null"); 
 
          Subject subject = new Subject();
          Principal principal = getPrincipal("anil");
@@ -80,11 +81,11 @@
 
          boolean result = am.isValid(principal, credential); 
          if(result == false)
-            throw new RuntimeException("Authentication Failed");
+            throw new RuntimeException(ErrorCodes.ACCESS_DENIED + "Authentication Failed");
          
          result = am.isValid(principal, credential, subject);
          if(result == false)
-            throw new RuntimeException("Authentication Failed");
+            throw new RuntimeException(ErrorCodes.ACCESS_DENIED + "Authentication Failed");
          
          if(subject.getPrincipals().size() < 1)
             throw new RuntimeException("Subject has zero principals"); 
@@ -107,7 +108,7 @@
 
          AuthenticationManager am = SecurityFactory.getAuthenticationManager(securityDomainName);
          if(am == null)
-            throw new RuntimeException("Authentication Manager is null"); 
+            throw new RuntimeException(ErrorCodes.ACCESS_DENIED + "Authentication Manager is null"); 
 
          Subject subject = new Subject();
          Principal principal = getPrincipal("anil");
@@ -115,19 +116,19 @@
 
          boolean result = am.isValid(principal, credential, subject);
          if(result == false) 
-            throw new RuntimeException("InValid Auth");
+            throw new RuntimeException(ErrorCodes.ACCESS_DENIED + "InValid Auth");
 
          if(subject.getPrincipals().size() < 1)
-            throw new RuntimeException("Subject has zero principals"); 
+            throw new RuntimeException(ErrorCodes.MISMATCH_SIZE + "Subject has zero principals"); 
          
          AuthorizationManager authzM = SecurityFactory.getAuthorizationManager(securityDomainName);
          if(authzM == null)
-            throw new RuntimeException("Authorization Manager is null"); 
+            throw new RuntimeException(ErrorCodes.NULL_VALUE + "Authorization Manager is null"); 
          
          Resource resource = getResource();
          int decision = authzM.authorize(resource, subject);
          if(decision != AuthorizationContext.PERMIT)
-            throw new RuntimeException("Authz is not permit");
+            throw new RuntimeException(ErrorCodes.ACCESS_DENIED + "Authz is not permit");
          
          System.out.println("Authorization successful");
       }

Modified: trunk/picketbox-infinispan/src/main/java/org/jboss/security/authentication/JBossCachedAuthenticationManager.java
===================================================================
--- trunk/picketbox-infinispan/src/main/java/org/jboss/security/authentication/JBossCachedAuthenticationManager.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/picketbox-infinispan/src/main/java/org/jboss/security/authentication/JBossCachedAuthenticationManager.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -41,6 +41,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.CacheableManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityContextAssociation;
@@ -127,7 +128,7 @@
    @Override
    public Principal getTargetPrincipal(Principal anotherDomainPrincipal, Map<String, Object> contextMap)
    {
-      throw new RuntimeException("Not implemented yet");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED + "Not implemented yet");
    }
 
    @Override

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 import javax.persistence.Table;
 import javax.persistence.Transient;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.identity.Identity;
 
 /**
@@ -141,7 +142,7 @@
    private void loadState()
    {
       if (this.permission != null)
-         throw new IllegalStateException("ACLEntry permission has already been set");
+         throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "ACLEntry permission has already been set");
       this.permission = new CompositeACLPermission(this.bitMask);
    }
 

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -39,6 +39,7 @@
 import javax.persistence.Transient;
 
 import org.hibernate.annotations.Cascade;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.Resource;
 import org.jboss.security.identity.Identity;
 
@@ -259,7 +260,7 @@
    public void setResource(Resource resource)
    {
       if (this.resource != null)
-         throw new IllegalStateException("ACL resource has already been set");
+         throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "ACL resource has already been set");
       this.resource = resource;
    }
 

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLProviderImpl.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLProviderImpl.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLProviderImpl.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationException;
 import org.jboss.security.authorization.Resource;
 import org.jboss.security.authorization.ResourceKeys;
@@ -75,7 +76,7 @@
       }
       catch (Exception e)
       {
-         throw new RuntimeException("Failed to instantiate persistence strategy class", e);
+         throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "Failed to instantiate persistence strategy class", e);
       }
    }
 
@@ -221,7 +222,7 @@
    public void setPersistenceStrategy(ACLPersistenceStrategy strategy)
    {
       if (strategy == null)
-         throw new IllegalArgumentException("PersistenceStrategy cannot be null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "PersistenceStrategy cannot be null");
       this.strategy = strategy;
    }
 
@@ -247,7 +248,7 @@
          return false;
       }
       else
-         throw new AuthorizationException("Unable to locate an ACL for the resource " + resource);
+         throw new AuthorizationException(ErrorCodes.PROCESSING_FAILED + "Unable to locate an ACL for the resource " + resource);
    }
 
    /**

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/EntitlementEntry.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/EntitlementEntry.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/EntitlementEntry.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -21,6 +21,7 @@
  */
 package org.jboss.security.acl;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.Resource;
 
 /**
@@ -51,7 +52,7 @@
    public EntitlementEntry(Resource resource, ACLPermission permission, String identityOrRole)
    {
       if(resource == null || permission == null)
-         throw new IllegalArgumentException("Illegal null value for resource or permission");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Illegal null value for resource or permission");
       this.resource = resource;
       this.permission = permission;
       this.identityOrRole = identityOrRole;

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -11,6 +11,7 @@
 import javax.persistence.NoResultException;
 import javax.persistence.Persistence;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.Resource;
 
 /**
@@ -59,7 +60,7 @@
    public ACL createACL(Resource resource, Collection<ACLEntry> entries)
    {
       if (resource == null)
-         throw new IllegalArgumentException("ACLs cannot be created for null resources");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ACLs cannot be created for null resources");
 
       // check the cache first.
       ACL acl = this.aclMap.get(resource);

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/RoleBasedACLProviderImpl.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/RoleBasedACLProviderImpl.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/RoleBasedACLProviderImpl.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationException;
 import org.jboss.security.authorization.Resource;
 import org.jboss.security.identity.Identity;
@@ -105,9 +106,9 @@
             return false;
          }
          else
-            throw new AuthorizationException("Unable to locate an ACL for the resource " + resource);
+            throw new AuthorizationException(ErrorCodes.PROCESSING_FAILED + "Unable to locate an ACL for the resource " + resource);
       }
-      throw new AuthorizationException("Unable to retrieve ACL: persistece strategy not set");
+      throw new AuthorizationException(ErrorCodes.PROCESSING_FAILED + "Unable to retrieve ACL: persistece strategy not set");
    }
 
    /**

Modified: trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/Util.java
===================================================================
--- trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/Util.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/Util.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -24,6 +24,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.Resource;
 import org.jboss.security.identity.Identity;
 import org.jboss.security.identity.plugins.IdentityFactory;
@@ -95,7 +96,7 @@
       {
          String[] identityParts = identityString.split(":");
          if (identityParts.length != 2)
-            throw new IllegalArgumentException("Malformed identity String: " + identityString);
+            throw new IllegalArgumentException(ErrorCodes.MISMATCH_SIZE + "Malformed identity String: " + identityString);
          try
          {
             identity = IdentityFactory.createIdentity(identityParts[0], identityParts[1]);

Modified: trunk/security-jboss-sx/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java
===================================================================
--- trunk/security-jboss-sx/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -30,6 +30,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.identity.Role;
 import org.jboss.security.identity.RoleGroup;
 import org.jboss.security.identity.RoleType;
@@ -208,7 +209,7 @@
    public boolean containsAtleastOneRole(RoleGroup anotherRole)
    {
       if (anotherRole == null)
-         throw new IllegalArgumentException("anotherRole is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "anotherRole is null");
       CopyOnWriteArrayList<Role> roleList = new CopyOnWriteArrayList<Role>(anotherRole.getRoles());
       for (Role r : roleList)
       {

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/CryptoUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -42,6 +42,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.Base64Encoder;
 import org.jboss.security.Base64Utils;
+import org.jboss.security.ErrorCodes;
 
 /** Various security related utilities like MessageDigest
  factories, SecureRandom access, password hashing.
@@ -513,11 +514,11 @@
       }
       catch(Exception e)
       {
-          throw new KeyException("Failed to create SecretKeySpec from session key, msg="+e.getMessage());
+          throw new KeyException(ErrorCodes.FAILED_TO_CREATE_SECRET_KEY_SPEC + e.getMessage());
       }
       catch(Throwable e)
       {
-         throw new KeyException("Unexpected exception during SecretKeySpec creation, msg="+e.getMessage());
+         throw new KeyException(ErrorCodes.UNEXPECTED_EXCEPTION_CREATE_SECRET_KEY_SPEC + e.getMessage());
       }
       return secretKey;
    }
@@ -559,7 +560,7 @@
       }
       catch(Throwable e)
       {
-         throw new GeneralSecurityException("Failed to create SealedObject, msg="+e.getMessage());
+         throw new GeneralSecurityException(ErrorCodes.FAILED_TO_CREATE_SEALEDOBJECT + e.getMessage());
       }
       return sealedObject;
    }
@@ -591,7 +592,7 @@
       }
       catch(Throwable e)
       {
-         throw new GeneralSecurityException("Failed to access SealedObject, msg="+e.getMessage());
+         throw new GeneralSecurityException(ErrorCodes.FAILED_TO_CREATE_SEALEDOBJECT + e.getMessage());
       }
       return data;
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAInterleave.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAInterleave.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAInterleave.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,8 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.ProviderException;
 
+import org.jboss.security.ErrorCodes;
+
 /** The SHA_Interleave algorithm as described in section 3.1 of RFC2945. This
  needs an SHA MessageDigest provider to function.
 
@@ -55,7 +57,7 @@
       }
       catch(NoSuchAlgorithmException e)
       {
-         throw new ProviderException("Failed to obtain SHA MessageDigest");
+         throw new ProviderException(ErrorCodes.FAILED_TO_OBTAIN_SHA);
       }
       evenBytes = new ByteArrayOutputStream();
       oddBytes = new ByteArrayOutputStream();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAReverseInterleave.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAReverseInterleave.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/crypto/digest/SHAReverseInterleave.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,8 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.ProviderException;
 
+import org.jboss.security.ErrorCodes;
+
 /** An alternate SHA Interleave algorithm as implemented in the SRP
  distribution. This version reverses the even and odd byte streams before
  performing the SHA digest.
@@ -59,7 +61,7 @@
       }
       catch(NoSuchAlgorithmException e)
       {
-         throw new ProviderException("Failed to obtain SHA MessageDigest");
+         throw new ProviderException(ErrorCodes.FAILED_TO_OBTAIN_SHA);
       }
       evenBytes = new ByteArrayOutputStream();
       oddBytes = new ByteArrayOutputStream();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AltClientLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AltClientLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AltClientLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -127,7 +127,7 @@
          the username and password from the callback hander.
       */
       if (callbackHandler == null)
-         throw new LoginException("Error: no CallbackHandler available " +
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Error: no CallbackHandler available " +
             "to garner authentication information from the user");
       
       PasswordCallback pc = new PasswordCallback("Password: ", false);
@@ -153,7 +153,7 @@
       }
       catch (UnsupportedCallbackException uce)
       {
-         throw new LoginException("Error: " + uce.getCallback().toString() +
+         throw new LoginException(ErrorCodes.WRONG_TYPE + "Error: " + uce.getCallback().toString() +
          " not available to garner authentication information " +
          "from the user");
       }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AppPolicy.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AppPolicy.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/AppPolicy.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -84,7 +84,7 @@
     public static void setDefaultAppPolicy(AppPolicy policy)
     {
         if( policy == null )
-            throw new IllegalArgumentException("The policy argument cannot be null");
+            throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "The policy argument cannot be null");
         defaultAppPolicy = policy;
     }
     public static AppPolicy getDefaultAppPolicy()
@@ -167,4 +167,4 @@
         return buffer.toString();
     }
    
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Base64Utils.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Base64Utils.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Base64Utils.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -106,7 +106,7 @@
    {
       int len = str.length();
       if(len == 0)
-         throw new NumberFormatException("Empty Base64 string");
+         throw new NumberFormatException(ErrorCodes.MISMATCH_SIZE + "Empty Base64 string");
 
       byte[] a = new byte[len + 1];
       char c;
@@ -121,7 +121,7 @@
                ;
          } catch(Exception e)
          {
-            throw new NumberFormatException("Illegal Base64 character");
+            throw new NumberFormatException(ErrorCodes.PROCESSING_FAILED + "Illegal Base64 character");
          }
          a[i] = (byte) j;
       }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -178,7 +178,7 @@
           the username and password from the callback hander.
        */
       if (callbackHandler == null)
-         throw new LoginException("Error: no CallbackHandler available " +
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Error: no CallbackHandler available " +
             "to garner authentication information from the user");
 
       PasswordCallback pc = new PasswordCallback("Password: ", false);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/JBossJSSESecurityDomain.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/JBossJSSESecurityDomain.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/JBossJSSESecurityDomain.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -413,9 +413,10 @@
    {
       if (this.serviceAuthToken == null)
       {
-         throw new IllegalStateException(
+         throw new IllegalStateException( ErrorCodes.NULL_ARGUMENT +
                getSecurityDomain()
-                     + " has been requested to provide sensitive security information, but no service authentication token has been configured on it. Use setServiceAuthToken().");
+                     + " has been requested to provide sensitive security information, " +
+                     "but no service authentication token has been configured on it. Use setServiceAuthToken().");
       }
 
       boolean verificationSuccessful = true;
@@ -439,7 +440,7 @@
          }
       }
 
-      throw new SecurityException("service authentication token verification failed");
+      throw new SecurityException(ErrorCodes.ACCESS_DENIED + "service authentication token verification failed");
    }
 
    @SuppressWarnings({"rawtypes", "unchecked"})

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/NestableGroup.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/NestableGroup.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/NestableGroup.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -90,7 +90,7 @@
     public boolean addMember(Principal group) throws IllegalArgumentException
     {
         if( (group instanceof Group) == false )
-            throw new IllegalArgumentException("The addMember argument must be a Group");
+            throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "The addMember argument must be a Group");
 
         rolesStack.addFirst(group);
         return true;

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/RunAsIdentity.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/RunAsIdentity.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/RunAsIdentity.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -60,7 +60,7 @@
       super(principalName != null ? principalName : ANOYMOUS_PRINCIPAL);
 
       if (roleName == null)
-         throw new IllegalArgumentException("The run-as identity must have at least one role");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "The run-as identity must have at least one role");
 
       runAsRoles.add(new SimplePrincipal(roleName));
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/SecurityUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/SecurityUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/SecurityUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -82,7 +82,7 @@
    public static Group getSubjectRoles(Subject theSubject)
    {
       if (theSubject == null)
-         throw new IllegalArgumentException("Subject is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Subject is null");
       Set<Group> subjectGroups = theSubject.getPrincipals(Group.class);
       Iterator<Group> iter = subjectGroups.iterator();
       Group roles = null;

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Util.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Util.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/Util.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -91,7 +91,7 @@
          else if( passwordCmdType.equals("CLASS") )
             password = invokePasswordClass(passwordCmd);
          else
-            throw new IllegalArgumentException("Unknown passwordCmdType: "+passwordCmdType);
+            throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "Unknown passwordCmdType: "+passwordCmdType);
       }
       return password;
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/AppCallbackHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/AppCallbackHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/AppCallbackHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -36,6 +36,8 @@
 import javax.security.auth.callback.TextInputCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.jboss.security.ErrorCodes;
+
 //$Id$
 
 /** 
@@ -206,14 +208,14 @@
                {
                   Object key = iter.next();
                   if(key instanceof String == false)
-                     throw new SecurityException("key is not a String");
+                     throw new SecurityException(ErrorCodes.KEY_IS_NOT_STRING );
                   mc.setInfo((String)key, keyValuePair.get(key));
                }  
             }
          }
          else
          {
-            throw new UnsupportedCallbackException(c, "Unrecognized Callback");
+            throw new UnsupportedCallbackException(c, ErrorCodes.UNRECOGNIZED_CALLBACK);
          }
       }
    }
@@ -230,7 +232,7 @@
       }
       catch(IOException e)
       {
-         throw new SecurityException("Failed to obtain username, ioe="+e.getMessage());
+         throw new SecurityException(ErrorCodes.FAILED_TO_OBTAIN_USERNAME + e.getMessage());
       }
       return uName;
    }
@@ -248,7 +250,7 @@
       }
       catch(IOException e)
       {
-         throw new SecurityException("Failed to obtain password, ioe="+e.getMessage());
+         throw new SecurityException(ErrorCodes.FAILED_TO_OBTAIN_PASSWORD + e.getMessage());
       }
       return pwd.toCharArray();
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/ConsoleInputHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/ConsoleInputHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/ConsoleInputHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -31,6 +31,8 @@
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.jboss.security.ErrorCodes;
+
 /** An implementation of CallbackHandler that obtains the values for
  NameCallback and PasswordCallback from the console.
 
@@ -71,7 +73,7 @@
             }
             catch(IOException e)
             {
-               throw new SecurityException("Failed to obtain username, ioe="+e.getMessage());
+               throw new SecurityException(ErrorCodes.FAILED_TO_OBTAIN_USERNAME + e.getMessage());
             }
          }
          else if (c instanceof PasswordCallback)
@@ -91,13 +93,13 @@
             }
             catch(IOException e)
             {
-               throw new SecurityException("Failed to obtain password, ioe="+e.getMessage());
+               throw new SecurityException(ErrorCodes.FAILED_TO_OBTAIN_PASSWORD + e.getMessage());
             }
          }
          else
          {
-            throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
+            throw new UnsupportedCallbackException(callbacks[i], ErrorCodes.UNRECOGNIZED_CALLBACK);
          }
       }
    }
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/DigestCallbackHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/DigestCallbackHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/DigestCallbackHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,7 +28,7 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
-import org.jboss.security.auth.callback.MapCallback;
+import org.jboss.security.ErrorCodes;
 
 /**
  * A CallbackHandler that is used to pass the RFC2617 parameters to the login module DigestCallback.
@@ -75,6 +75,6 @@
             }
         }
         if (foundCallback == false)
-            throw new UnsupportedCallbackException(firstUnknown, "Unrecognized Callback");
+            throw new UnsupportedCallbackException(firstUnknown, ErrorCodes.UNRECOGNIZED_CALLBACK);
     }
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JASPICallbackHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JASPICallbackHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JASPICallbackHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 import javax.security.auth.message.callback.GroupPrincipalCallback;
 import javax.security.auth.message.callback.PasswordValidationCallback;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityContextUtil;
@@ -73,7 +74,7 @@
          GroupPrincipalCallback groupPrincipalCallback = (GroupPrincipalCallback) callback; 
          SecurityContext currentSC = SecurityActions.getCurrentSecurityContext();
          if( currentSC == null )
-            throw new RuntimeException( " The security context is null " );
+            throw new RuntimeException(ErrorCodes.SECURITY_CONTEXT_NULL);
          
          String[] rolesArray = groupPrincipalCallback.getGroups();
          int sizeOfRoles = rolesArray != null ? rolesArray.length : 0;
@@ -105,7 +106,7 @@
          
          Subject subject = callerPrincipalCallback.getSubject();
          if( currentSC == null )
-            throw new RuntimeException( " The security context is null " );
+            throw new RuntimeException(ErrorCodes.SECURITY_CONTEXT_NULL);
          
          if( subject != null )
          {
@@ -125,7 +126,7 @@
 
          SecurityContext currentSC = SecurityActions.getCurrentSecurityContext();
          if( currentSC == null )
-            throw new RuntimeException( " The security context is null " );
+            throw new RuntimeException(ErrorCodes.SECURITY_CONTEXT_NULL);
          String userName = passwordValidationCallback.getUsername();
          char[] password = passwordValidationCallback.getPassword();
          Subject subject = passwordValidationCallback.getSubject();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JBossCallbackHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JBossCallbackHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/JBossCallbackHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,8 @@
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  * Serializable Callback Handler
  * @author Anil.Saldhana at redhat.com
@@ -133,7 +135,7 @@
          {
          } 
 
-         throw new UnsupportedCallbackException(c, "Unrecognized Callback");
+         throw new UnsupportedCallbackException(c, ErrorCodes.UNRECOGNIZED_CALLBACK);
       }
       
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/RFC2617Digest.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/RFC2617Digest.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/RFC2617Digest.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import javax.security.auth.callback.Callback;
 
 import org.jboss.crypto.digest.DigestCallback;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.callback.MapCallback;
 
 /**
@@ -219,7 +220,8 @@
 
     String rfc2617;
 
-    public void init(Map options) {
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+	public void init(Map options) {
         username = (String) options.get("javax.security.auth.login.name");
         password = (String) options.get("javax.security.auth.login.password");
         String flag = (String) options.get("passwordIsA1Hash");
@@ -267,7 +269,7 @@
                 hA1 = H(A1, digest) + ":" + nonce + ":" + cnonce;
             }
         } else {
-            throw new IllegalArgumentException("Unsupported algorigthm: " + algorithm);
+            throw new IllegalArgumentException(ErrorCodes.UNSUPPORTED_ALGO + algorithm);
         }
 
         // 3.2.2.3 A2. First check to see if the A2 hash has been precomputed
@@ -278,7 +280,7 @@
             if (qop == null || qop.equals("auth")) {
                 A2 = method + ":" + digestURI;
             } else {
-                throw new IllegalArgumentException("Unsupported qop=" + qop);
+                throw new IllegalArgumentException(ErrorCodes.UNSUPPORTED_QOP + qop);
             }
             hA2 = H(A2, digest);
         }
@@ -360,4 +362,4 @@
         String hA1 = H(A1, digest);
         System.out.println("RFC2617 A1 hash: " + hA1);
     }
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/SecurityAssociationHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/SecurityAssociationHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/SecurityAssociationHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -31,6 +31,8 @@
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.jboss.security.ErrorCodes;
+
 /** An implementation of CallbackHandler is assigned a Principal, and
  opaque Object credential as values passed to the constructor. This is suitable
  for environments that need non-interactive JAAS logins and is used by the
@@ -125,7 +127,7 @@
             catch (Exception e)
             {
             }
-            throw new UnsupportedCallbackException(c, "Unrecognized Callback");
+            throw new UnsupportedCallbackException(c, ErrorCodes.UNRECOGNIZED_CALLBACK);
          }
       }
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/UsernamePasswordHandler.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/UsernamePasswordHandler.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/callback/UsernamePasswordHandler.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,8 @@
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.jboss.security.ErrorCodes;
+
 /** A simple implementation of CallbackHandler that sets a username and
 password in the handle(Callback[]) method to that passed in to
 the constructor. This is suitable for environments that need non-interactive
@@ -98,8 +100,8 @@
          }
          else
          {
-            throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
+            throw new UnsupportedCallbackException(callbacks[i], ErrorCodes.UNRECOGNIZED_CALLBACK);
          }
       }
    }
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntry.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntry.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntry.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -25,6 +25,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.login.LoginModuleStackHolder;
 import org.jboss.security.config.ControlFlag;
 import org.jboss.security.config.ModuleOption;
@@ -72,9 +73,9 @@
    public void addOption(ModuleOption option)
    { 
       if(option == null)
-         throw new IllegalArgumentException("Option is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Option");
       if(options == null)
-         throw new IllegalStateException("Options is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Options");
       options.put(option.getName(), option.getValue());
    }
    
@@ -112,7 +113,7 @@
    public void setLoginModuleStackHolder(LoginModuleStackHolder loginModuleStackHolder)
    {
       if(loginModuleStackHolder == null)
-         throw new IllegalArgumentException("loginModuleStackHolder is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "loginModuleStackHolder");
       this.loginModuleStackHolder = loginModuleStackHolder;
       this.loginModuleStackHolderName = this.loginModuleStackHolder.getName();
    }
@@ -125,7 +126,7 @@
    public void setLoginModuleStackHolderName(String loginModuleStackHolderName)
    {
       if(loginModuleStackHolderName == null)
-         throw new IllegalArgumentException("loginModuleStackHolderName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "loginModuleStackHolder");
       this.loginModuleStackHolderName = loginModuleStackHolderName;
    }
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/DelegatingServerAuthModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/DelegatingServerAuthModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/DelegatingServerAuthModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 import javax.security.auth.message.MessageInfo;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
  
 /**
  *  Server Auth Module that delegates work to a login context 
@@ -77,7 +78,7 @@
 
    public AuthStatus secureResponse(MessageInfo messageInfo, Subject arg1) throws AuthException
    { 
-      throw new RuntimeException("Not Implemented");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED);
    } 
    
    @Override

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/HttpServletServerAuthModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/HttpServletServerAuthModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/HttpServletServerAuthModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -30,6 +30,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
 import org.jboss.security.auth.callback.JBossCallbackHandler;
 
@@ -65,7 +66,7 @@
 
    public AuthStatus secureResponse(MessageInfo arg0, Subject arg1) throws AuthException
    { 
-      throw new RuntimeException("Not Implemented");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED);
    }
    
    private Principal getUserName(MessageInfo messageInfo)
@@ -73,7 +74,7 @@
       Object requestInfo =  messageInfo.getRequestMessage();
       String userNameParam = (String) options.get("userNameParam");
       if(requestInfo instanceof HttpServletRequest == false)
-         throw new IllegalStateException("Wrong Form of request:" + requestInfo);
+         throw new IllegalStateException(ErrorCodes.WRONG_TYPE + "request:" + requestInfo);
       HttpServletRequest hsr = (HttpServletRequest)requestInfo;
       return new SimplePrincipal(hsr.getParameter(userNameParam));
    }
@@ -83,7 +84,7 @@
       Object requestInfo = messageInfo.getRequestMessage();
       String passwordParam = (String) options.get("passwordParam");
       if(requestInfo instanceof HttpServletRequest == false)
-         throw new IllegalStateException("Wrong Form of request:" + requestInfo);
+         throw new IllegalStateException(ErrorCodes.WRONG_TYPE + "request:" + requestInfo);
       HttpServletRequest hsr = (HttpServletRequest)requestInfo;
       return  hsr.getParameter(passwordParam);
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/SimpleClientAuthModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/SimpleClientAuthModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/modules/SimpleClientAuthModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -33,6 +33,7 @@
 import javax.security.auth.message.MessagePolicy;
 import javax.security.auth.message.module.ClientAuthModule;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
 
 /**
@@ -96,9 +97,9 @@
       Set sourceSet = source.getPrincipals(SimplePrincipal.class);
       Set recipientSet = recipient.getPrincipals(SimplePrincipal.class);
       if(sourceSet == null && recipientSet == null)
-         throw new AuthException("Principals are null");
+         throw new AuthException(ErrorCodes.NULL_VALUE + "Principals");
       if(sourceSet.size() != recipientSet.size())
-         throw new AuthException("Principals size are different");
+         throw new AuthException(ErrorCodes.MISMATCH_SIZE + "Principals");
       return AuthStatus.SUCCESS;
    } 
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JASPIAuthenticationInfo.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JASPIAuthenticationInfo.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JASPIAuthenticationInfo.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -34,6 +34,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.container.config.AuthModuleEntry;
 import org.jboss.security.config.Attribute;
 import org.jboss.security.config.BaseSecurityInfo;
@@ -180,7 +181,7 @@
    public BaseSecurityInfo<Object> merge(BaseSecurityInfo<Object> bi)
    {
       if (bi instanceof JASPIAuthenticationInfo == false)
-         throw new IllegalArgumentException("Base policy does not contain a JASPI authentication configuration");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "Base policy does not contain a JASPI authentication configuration");
       // merge the auth modules
       JASPIAuthenticationInfo merged = (JASPIAuthenticationInfo) super.merge(bi);
       // merge the stacks of login modules

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackHolder.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackHolder.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,8 @@
 import javax.security.auth.AuthPermission;
 import javax.security.auth.login.AppConfigurationEntry;
 
+import org.jboss.security.ErrorCodes;
+
 //$Id$
 
 /**
@@ -83,10 +85,9 @@
    public void setAppConfigurationEntry(List entries)
    {
       if(entries  == null)
-         throw new IllegalArgumentException("Illegal Null Argument: entries");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "entries");
       if(appEntries == null)
          this.appEntries = new ArrayList();
       this.appEntries.addAll(entries);
    }
-   
 }
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,7 @@
 import javax.security.auth.login.Configuration;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.config.ApplicationPolicy;
 import org.jboss.security.config.ApplicationPolicyRegistration;
 import org.jboss.security.config.PolicyConfig;
@@ -199,7 +200,7 @@
       ClassLoader tcl = SecurityActions.getContextClassLoader();
       loginConfigURL = tcl.getResource(resourceName);
       if (loginConfigURL == null)
-         throw new IOException("Failed to find resource: " + resourceName);
+         throw new IOException(ErrorCodes.NULL_VALUE + "Failed to find resource: " + resourceName);
    }
 
    public void setParentConfig(Configuration parentConfig)
@@ -434,7 +435,7 @@
    {
       InputStream is = sunConfig.openStream();
       if (is == null)
-         throw new IOException("InputStream is null for: " + sunConfig);
+         throw new IOException(ErrorCodes.NULL_VALUE + "InputStream is null for: " + sunConfig);
 
       InputStreamReader configFile = new InputStreamReader(is);
       boolean trace = log.isTraceEnabled();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigFactory.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -34,6 +34,7 @@
 import javax.security.auth.message.config.RegistrationListener;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 
 //$Id$
 
@@ -92,10 +93,9 @@
     * @see javax.security.auth.message.config.AuthConfigFactory#detachListener(javax.security.auth.message.config.RegistrationListener, java.lang.String, java.lang.String)
     */
    public String[] detachListener(RegistrationListener listener, String layer, String appContext)
-   {
-
+   { 
       if (listener == null)
-         throw new IllegalArgumentException("listener is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "listener");
 
       String[] arr = new String[0];
       String input = layer + "^" + appContext;
@@ -176,7 +176,7 @@
       String key = (String) idKeyMap.get(registrationID);
       StringTokenizer st = new StringTokenizer(key, "^");
       if (st.countTokens() < 2)
-         throw new IllegalStateException("Invalid key obtained=" + key);
+         throw new IllegalStateException(ErrorCodes.MISMATCH_SIZE + "Invalid key obtained=" + key);
 
       final String layer = st.nextToken();
       final String appCtx = st.nextToken();
@@ -240,11 +240,12 @@
     * (non-Javadoc)
     * @see javax.security.auth.message.config.AuthConfigFactory#registerConfigProvider(java.lang.String, java.util.Map, java.lang.String, java.lang.String, java.lang.String)
     */
+   @SuppressWarnings("rawtypes")
    public String registerConfigProvider(String className, Map properties, String layer, String appContext,
          String description)
    {
       if (className == null || className.length() == 0)
-         throw new IllegalArgumentException("className is null or zero length");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "className is null or zero length");
 
       // Instantiate the provider
       AuthConfigProvider acp = null;
@@ -258,7 +259,7 @@
       catch (Exception e)
       {
          log.error("Cannot register provider:" + className + ":", e);
-         throw new SecurityException("Cannot register Provider " + className + ":reason=" + e);
+         throw new SecurityException(ErrorCodes.CANNOT_REGISTER_PROVIDER + className + ":reason=" + e);
       }
 
       return this.registerConfigProvider(acp, layer, appContext, description);
@@ -271,7 +272,7 @@
    public String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description)
    {
       if (provider == null)
-         throw new IllegalArgumentException("provider is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "provider");
 
       StringBuilder key = new StringBuilder();
       key.append(layer == null ? "null" : layer);
@@ -310,7 +311,7 @@
    public boolean removeRegistration(String registrationID)
    {
       if (registrationID == null)
-         throw new IllegalArgumentException("registrationID is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "registrationID");
 
       String key = idKeyMap.get(registrationID);
       if (key != null)

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossAuthConfigProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -31,6 +31,7 @@
 import javax.security.auth.message.config.ServerAuthConfig;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 
 //$Id$
 
@@ -117,7 +118,7 @@
    {
       String cbhClass = System.getProperty(cbhProperty);
       if(cbhClass == null)
-         throw new IllegalStateException("CallbackHandler not defined by system property "+
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "CallbackHandler not defined by system property "+
                cbhProperty);
       ClassLoader cl = SecurityActions.getContextClassLoader();
       Class<?> cls = cl.loadClass(cbhClass);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthConfig.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthConfig.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthConfig.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -33,6 +33,8 @@
 import javax.security.auth.message.config.ClientAuthConfig;
 import javax.security.auth.message.config.ClientAuthContext;
 
+import org.jboss.security.ErrorCodes;
+
 //$Id$
 
 /**
@@ -94,7 +96,7 @@
     */
    public String getOperation(MessageInfo messageInfo)
    { 
-      throw new IllegalStateException("Not Implemented");
+      throw new IllegalStateException(ErrorCodes.NOT_YET_IMPLEMENTED);
    }
 
    /**
@@ -119,11 +121,11 @@
 
    public String getAuthContextID(MessageInfo messageInfo)
    {
-      throw new RuntimeException("Not Implemented");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED);
    }
 
    public boolean isProtected()
    { 
-      throw new RuntimeException("Not Implemented");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED);
    } 
 }
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthContext.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthContext.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossClientAuthContext.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,8 @@
 import javax.security.auth.message.config.ClientAuthContext;
 import javax.security.auth.message.module.ClientAuthModule;
 
+import org.jboss.security.ErrorCodes;
+
 //$Id$
 
 /**
@@ -52,7 +54,7 @@
    public JBossClientAuthContext(JBossClientAuthConfig config)
    {
       if(config == null)
-         throw new IllegalArgumentException("config is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "config");
       this.config = config;
    }
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthConfig.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthConfig.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthConfig.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -36,6 +36,7 @@
 import javax.security.auth.message.config.ServerAuthContext;
 import javax.security.auth.message.module.ServerAuthModule;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.auth.callback.JBossCallbackHandler;
@@ -104,7 +105,7 @@
       else{
          secDomain = (String) properties.get("security-domain");
          if(secDomain == null)
-            throw new IllegalStateException("Unable to obtain security domain from " +
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Unable to obtain security domain from " +
             		"configuration or security context");
       }
       
@@ -116,10 +117,10 @@
          ap = SecurityConfiguration.getApplicationPolicy(defaultAppDomain);
       }
       if(ap == null)
-         throw new IllegalStateException("No Application Policy found");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "No Application Policy found");
       BaseAuthenticationInfo bai = ap.getAuthenticationInfo();
       if(bai == null)
-         throw new IllegalStateException("Authentication Info not set in security domain="+ secDomain 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authentication Info not set in security domain="+ secDomain 
                + " or "+ defaultAppDomain);
       
       if(bai instanceof AuthenticationInfo)
@@ -219,7 +220,7 @@
 
    public boolean isProtected()
    {
-      throw new RuntimeException("Not Implemented");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED);
    }  
  
    @SuppressWarnings({"rawtypes", "unchecked"})

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthContext.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthContext.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/message/config/JBossServerAuthContext.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,7 @@
 import javax.security.auth.message.module.ServerAuthModule;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.config.ControlFlag;
 
 //$Id$
@@ -135,18 +136,10 @@
             supportingModules.add(sam); 
       }
       if(supportingModules.size() == 0)
-         throw new RuntimeException("No ServerAuthModule configured to support type:"+requestType);
+         throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "No ServerAuthModule configured to support type:"+requestType);
       
       AuthStatus authStatus = invokeModules(messageInfo, clientSubject, serviceSubject);
       return authStatus;
-      
-      /*for(ServerAuthModule sam:supportingModules)
-      {
-         status = sam.validateRequest(messageInfo, clientSubject, serviceSubject);
-         if(status == AuthStatus.FAILURE)
-            break;
-      }
-      return status;*/
    } 
    
    private AuthStatus invokeModules(MessageInfo messageInfo,
@@ -210,11 +203,11 @@
       //All the authorization modules have been visited.
       String msg = getAdditionalErrorMessage(moduleException);
       if(encounteredRequiredError)
-         throw new AuthException("Auth Failed:"+ msg);
+         throw new AuthException(ErrorCodes.PROCESSING_FAILED + "Auth Failed:"+ msg);
       if(overallDecision == AuthStatus.FAILURE && encounteredOptionalError)
-         throw new AuthException("Auth Failed:" + msg);
+         throw new AuthException(ErrorCodes.PROCESSING_FAILED + "Auth Failed:" + msg);
       if(overallDecision == AuthStatus.FAILURE)
-         throw new AuthException("Auth Failed:Denied.");
+         throw new AuthException(ErrorCodes.PROCESSING_FAILED + "Auth Failed:Denied.");
       return AuthStatus.SUCCESS;
    }
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/BaseCertLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/BaseCertLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/BaseCertLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -41,6 +41,7 @@
 import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.JSSESecurityDomain;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityDomain;
@@ -184,7 +185,7 @@
             catch(Exception e)
             {
                log.debug("Failed to create principal", e);
-               throw new LoginException("Failed to create principal: "+ e.getMessage());
+               throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to create principal: "+ e.getMessage());
             }
          }
 
@@ -225,7 +226,7 @@
          if (!validateCredential(alias, credential))
          {
             log.debug("Bad credential for alias=" + alias);
-            throw new FailedLoginException("Supplied Credential did not match existing credential for " + alias);
+            throw new FailedLoginException(ErrorCodes.WRONG_VALUE + "Supplied Credential did not match existing credential for " + alias);
          }
       }
 
@@ -295,7 +296,7 @@
       // prompt for a username and password
       if (callbackHandler == null)
       {
-         throw new LoginException("Error: no CallbackHandler available to collect authentication information");
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Error: no CallbackHandler available to collect authentication information");
       }
       NameCallback nc = new NameCallback("Alias: ");
       ObjectCallback oc = new ObjectCallback("Certificate: ");
@@ -338,11 +339,11 @@
       catch (IOException e)
       {
          log.debug("Failed to invoke callback", e);
-         throw new LoginException("Failed to invoke callback: "+e.toString());
+         throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to invoke callback: "+e.toString());
       }
       catch (UnsupportedCallbackException uce)
       {
-         throw new LoginException("CallbackHandler does not support: "
+         throw new LoginException(ErrorCodes.UNRECOGNIZED_CALLBACK + "CallbackHandler does not support: "
             + uce.getCallback());
       }
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/CertRolesLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/CertRolesLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/CertRolesLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -30,6 +30,8 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  * Certificate Login Module that uses a properties file to store role information.
  * This works just like the UsersRolesLoginModule, only without the users.properties
@@ -111,7 +113,7 @@
          log.trace("enter: login()");
 
       if (roles == null)
-         throw new LoginException("Missing roles.properties file.");
+         throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Missing roles.properties file.");
       boolean wasSuccessful = super.login();
 
       if( trace )

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -39,6 +39,7 @@
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.plugins.TransactionManagerLocator;
 
 
@@ -130,7 +131,7 @@
       }
       catch (NamingException e)
       {
-         throw new RuntimeException("Unable to get Transaction Manager", e);
+         throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "Unable to get Transaction Manager", e);
       }
    }
 
@@ -156,7 +157,7 @@
          try
          {
             if(tm == null)
-               throw new IllegalStateException("Transaction Manager is null");
+               throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Transaction Manager is null");
             tx = tm.suspend();
          }
          catch (SystemException e)
@@ -182,7 +183,7 @@
          {
             if(trace)
                log.trace("Query returned no matches from db");
-            throw new FailedLoginException("No matching username found in Principals");
+            throw new FailedLoginException(ErrorCodes.PROCESSING_FAILED + "No matching username found in Principals");
          }
          
          password = rs.getString(1);
@@ -192,13 +193,13 @@
       }
       catch(NamingException ex)
       {
-         LoginException le = new LoginException("Error looking up DataSource from: "+dsJndiName);
+         LoginException le = new LoginException(ErrorCodes.PROCESSING_FAILED + "Error looking up DataSource from: "+dsJndiName);
          le.initCause(ex);
          throw le;
       }
       catch(SQLException ex)
       {
-         LoginException le = new LoginException("Query failed");
+         LoginException le = new LoginException(ErrorCodes.PROCESSING_FAILED + "Query failed");
          le.initCause(ex);
          throw le;
       }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -39,6 +39,7 @@
 import javax.transaction.TransactionManager;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimpleGroup;
 import org.jboss.security.plugins.TransactionManagerLocator;
 
@@ -79,7 +80,7 @@
            throw new RuntimeException(e1);
         }
         if(tm == null)
-           throw new IllegalStateException("Transaction Manager is null");
+           throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Transaction Manager is null");
      }      
      Transaction tx = null;
      if (suspendResume)
@@ -120,7 +121,7 @@
            if( trace )
               log.trace("No roles found");
            if( aslm.getUnauthenticatedIdentity() == null )
-              throw new FailedLoginException("No matching username found in Roles");
+              throw new FailedLoginException(ErrorCodes.PROCESSING_FAILED + "No matching username found in Roles");
            /* We are running with an unauthenticatedIdentity so create an
               empty Roles set and return.
            */
@@ -156,13 +157,13 @@
      }
      catch(NamingException ex)
      {
-        LoginException le = new LoginException("Error looking up DataSource from: "+dsJndiName);
+        LoginException le = new LoginException(ErrorCodes.PROCESSING_FAILED + "Error looking up DataSource from: "+dsJndiName);
         le.initCause(ex);
         throw le;
      }
      catch(SQLException ex)
      {
-        LoginException le = new LoginException("Query failed");
+        LoginException le = new LoginException(ErrorCodes.PROCESSING_FAILED + "Query failed");
         le.initCause(ex);
         throw le;
      }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -42,6 +42,7 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimpleGroup;
 import org.jboss.security.Util;
 
@@ -472,7 +473,7 @@
       if (results.hasMore() == false)
       {
          results.close();
-         throw new NamingException("Search of baseDN(" + baseDN + ") found no matches");
+         throw new NamingException(ErrorCodes.PROCESSING_FAILED + "Search of baseDN(" + baseDN + ") found no matches");
       }
 
       SearchResult sr = (SearchResult) results.next();
@@ -492,7 +493,7 @@
           if (sr.isRelative() == true)
                   userDN = name + ("".equals(baseDN) ? "" : "," + baseDN);
           else
-                  throw new NamingException("Can't follow referal for authentication: " + name);
+                  throw new NamingException(ErrorCodes.PROCESSING_FAILED + "Can't follow referal for authentication: " + name);
       }
 
       results.close();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapUsersLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapUsersLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapUsersLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -39,6 +39,7 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.Util;
 
 /**
@@ -145,7 +146,7 @@
          }
          catch (Exception e)
          {
-            throw new IllegalArgumentException("Unable to decode bindCredential", e);
+            throw new IllegalArgumentException(ErrorCodes.PROCESSING_FAILED + "Unable to decode bindCredential", e);
          }
       }
       baseDN = (String) options.get(BASE_CTX_DN);
@@ -305,7 +306,7 @@
       if (!results.hasMore())
       {
          results.close();
-         throw new NamingException("Search of baseDN(" + baseDN + ") found no matches");
+         throw new NamingException(ErrorCodes.PROCESSING_FAILED + "Search of baseDN(" + baseDN + ") found no matches");
       }
 
       SearchResult sr = results.next();
@@ -325,7 +326,7 @@
          if (sr.isRelative())
             userDN = name + ("".equals(baseDN) ? "" : "," + baseDN);
          else
-            throw new NamingException("Can't follow referal for authentication: " + name);
+            throw new NamingException(ErrorCodes.PROCESSING_FAILED + "Can't follow referal for authentication: " + name);
       }
 
       results.close();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/ProxyLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/ProxyLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/ProxyLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,8 @@
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 
+import org.jboss.security.ErrorCodes;
+
 /** A proxy LoginModule that loads a delegate LoginModule using
 the current thread context class loader. The purpose of this
 module is to work around the current JAAS class loader limitation
@@ -94,9 +96,9 @@
     public boolean login() throws LoginException
     {
         if( moduleName == null )
-            throw new LoginException("Required moduleName option not given");
+            throw new LoginException(ErrorCodes.NULL_VALUE + "Required moduleName option not given");
         if( delegate == null )
-            throw new LoginException("Failed to load LoginModule: "+moduleName);
+            throw new LoginException(ErrorCodes.NULL_VALUE + "Failed to load LoginModule: "+moduleName);
 
         return delegate.login();
     }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/RoleMappingLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/RoleMappingLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/RoleMappingLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -31,6 +31,7 @@
 import javax.security.auth.spi.LoginModule;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.util.StringPropertyReplacer;
 
 //$Id$
@@ -97,7 +98,7 @@
       //Get the properties file name from the options
       String propFileName = (String)options.get("rolesProperties");
       if(propFileName == null)
-         throw new IllegalStateException("rolesProperties option needs to be provided");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "rolesProperties option needs to be provided");
       // Replace any system property references like ${x}
       propFileName = StringPropertyReplacer.replaceProperties(propFileName);
       Group group = getExistingRolesFromSubject();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsernamePasswordLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsernamePasswordLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsernamePasswordLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -38,6 +38,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.crypto.digest.DigestCallback;
+import org.jboss.security.ErrorCodes;
 
 
 /** An abstract subclass of AbstractServerLoginModule that imposes
@@ -188,7 +189,7 @@
             catch(Exception e)
             {
                log.debug("Failed to create principal", e);
-               throw new LoginException("Failed to create principal: "+ e.getMessage());
+               throw new LoginException(ErrorCodes.PROCESSING_FAILED  + "Failed to create principal: "+ e.getMessage());
             }
          }
          Object password = sharedState.get("javax.security.auth.login.password");
@@ -235,7 +236,7 @@
          catch(Exception e)
          {
             log.debug("Failed to create principal", e);
-            throw new LoginException("Failed to create principal: "+ e.getMessage());
+            throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to create principal: "+ e.getMessage());
          }
 
          // Hash the user entered password if password hashing is in use
@@ -307,7 +308,7 @@
       // prompt for a username and password
       if( callbackHandler == null )
       {
-         throw new LoginException("Error: no CallbackHandler available " +
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Error: no CallbackHandler available " +
          "to collect authentication information");
       }
       
@@ -331,13 +332,13 @@
       }
       catch(IOException e)
       {
-         LoginException le = new LoginException("Failed to get username/password");
+         LoginException le = new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to get username/password");
          le.initCause(e);
          throw le;
       }
       catch(UnsupportedCallbackException e)
       {
-         LoginException le = new LoginException("CallbackHandler does not support: " + e.getCallback());
+         LoginException le = new LoginException(ErrorCodes.UNRECOGNIZED_CALLBACK + "CallbackHandler does not support: " + e.getCallback());
          le.initCause(e);
          throw le;
       }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -34,6 +34,8 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  * A simple properties file based login module that consults a Java Properties
  * formatted text files for username to password("users.properties") mapping.
@@ -98,7 +100,7 @@
    public boolean login() throws LoginException
    {
       if (users == null)
-         throw new LoginException("Missing users.properties file.");
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Missing users.properties file.");
 
       return super.login();
    }
@@ -138,7 +140,7 @@
       ClassLoader loader = SecurityActions.getContextClassLoader();
       URL url = loader.getResource(propertiesName);
       if (url == null)
-         throw new IOException("Properties file " + propertiesName + " not found");
+         throw new IOException(ErrorCodes.NULL_VALUE + "Properties file " + propertiesName + " not found");
 
       super.log.trace("Properties file=" + url);
 
@@ -150,7 +152,7 @@
       }
       else
       {
-         throw new IOException("Properties file " + propertiesName + " not avilable");
+         throw new IOException(ErrorCodes.NULL_VALUE + "Properties file " + propertiesName + " not avilable");
       }
       return bundle;
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersRolesLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersRolesLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersRolesLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -30,6 +30,7 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.util.StringPropertyReplacer;
 
 /** A simple Properties map based login module that consults two Java Properties
@@ -147,9 +148,9 @@
    public boolean login() throws LoginException
    {
       if (users == null)
-         throw new LoginException("Missing users.properties file.");
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Missing users.properties file.");
       if (roles == null)
-         throw new LoginException("Missing roles.properties file.");
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Missing roles.properties file.");
 
       return super.login();
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -43,6 +43,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.Base64Encoder;
 import org.jboss.security.Base64Utils;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimpleGroup;
 
 /**
@@ -268,7 +269,7 @@
          }
          else
          {
-            throw new IOException("Properties file " + propertiesName + " not available");
+            throw new IOException(ErrorCodes.NULL_VALUE + "Properties file " + propertiesName + " not available");
          }
          if (trace)
             log.trace("Loaded properties, users="+bundle.keySet());
@@ -355,7 +356,7 @@
          }
          else
          {
-            throw new IOException("Properties file " + propertiesName + " not available");
+            throw new IOException(ErrorCodes.NULL_VALUE + "Properties file " + propertiesName + " not available");
          }
          if (trace)
             log.trace("Loaded properties, users=" + bundle.keySet());

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/XMLLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/XMLLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/XMLLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,8 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
+
 /** A login module that obtains its security information directly from its
  login module options. The name of the login module comes from the use of
  the login-config.xml descriptor which allows the user/roles content to be
@@ -100,7 +102,7 @@
    public boolean login() throws LoginException
    {
       if (users == null)
-         throw new LoginException("Missing usersInfo user/role mapping");
+         throw new LoginException(ErrorCodes.NULL_VALUE + "Missing usersInfo user/role mapping");
 
       return super.login();
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/AbstractAuthorizationModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/AbstractAuthorizationModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/AbstractAuthorizationModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 import javax.security.auth.callback.CallbackHandler;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.AuthorizationException;
 import org.jboss.security.authorization.AuthorizationModule;
@@ -138,7 +139,7 @@
       ResourceType layer = resource.getLayer();
       String delegateStr = (String)delegateMap.get(layer);
       if(delegateStr == null)
-         throw new IllegalStateException("Delegate is missing for layer="+layer);
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Delegate is missing for layer="+layer);
       AuthorizationModuleDelegate delegate = null;
       try
       {
@@ -194,7 +195,7 @@
          String keyPair = st.nextToken();
          StringTokenizer keyst = new StringTokenizer(keyPair,"=");
          if(keyst.countTokens() != 2)
-            throw new IllegalStateException("DelegateMap entry invalid:"+keyPair);
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "DelegateMap entry invalid:"+keyPair);
          String key = keyst.nextToken();
          String value = keyst.nextToken();
          this.delegateMap.put(ResourceType.valueOf(key),value);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBJACCPolicyModuleDelegate.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBJACCPolicyModuleDelegate.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBJACCPolicyModuleDelegate.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -34,6 +34,7 @@
 import javax.security.jacc.EJBRoleRefPermission;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.security.authorization.Resource;
@@ -75,14 +76,14 @@
    public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
    {
       if(resource instanceof EJBResource == false)
-         throw new IllegalArgumentException("resource is not an EJBResource");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "resource is not an EJBResource");
       
       EJBResource ejbResource = (EJBResource) resource;
       
       //Get the context map
       Map<String,Object> map = resource.getMap();
       if(map == null)
-         throw new IllegalStateException("Map from the Resource is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Map from the Resource is null");
 
       this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
       

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBPolicyModuleDelegate.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBPolicyModuleDelegate.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBPolicyModuleDelegate.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -31,6 +31,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.AnybodyPrincipal;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.RunAs;
 import org.jboss.security.RunAsIdentity;
 import org.jboss.security.authorization.AuthorizationContext;
@@ -83,14 +84,14 @@
    public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
    {
       if(resource instanceof EJBResource == false)
-         throw new IllegalArgumentException("resource is not an EJBResource");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "resource is not an EJBResource");
       
       EJBResource ejbResource = (EJBResource) resource;
       
       //Get the context map
       Map<String,Object> map = resource.getMap();
       if(map == null)
-         throw new IllegalStateException("Map from the Resource is null"); 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Map from the Resource is null"); 
       
       this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
       
@@ -127,7 +128,7 @@
       if (methodRoles == null)
       {
          if(this.ejbMethod == null)
-            throw new IllegalStateException("ejbMethod is null");
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "ejbMethod is null");
          String method = this.ejbMethod.getName();
          String msg = "No method permissions assigned to method=" + method
             + ", interface=" + methodInterface;
@@ -152,11 +153,11 @@
             
             // Now actually check if the current caller has one of the required method roles
             if(principalRole == null)
-               throw new IllegalStateException("Principal Role is null");
+               throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Principal Role is null");
             if(methodRoles.containsAtleastOneRole(principalRole) == false)
             {
                if(this.ejbMethod == null)
-                  throw new IllegalStateException("ejbMethod is null");
+                  throw new IllegalStateException(ErrorCodes.NULL_VALUE + "ejbMethod is null");
                
                //Set<Principal> userRoles = am.getUserRoles(ejbPrincipal);
                String method = this.ejbMethod.getName(); 
@@ -236,7 +237,7 @@
          // which will throw an exception in case no matching
          // security ref is found.
          if(this.ejbRestrictions)
-            throw new RuntimeException("No matching role found in the deployment descriptor"+
+            throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "No matching role found in the deployment descriptor"+
                   " for "+this.roleName);
          else
          {

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLPolicyModuleDelegate.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLPolicyModuleDelegate.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLPolicyModuleDelegate.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import javax.security.auth.Subject;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.security.authorization.Resource;
@@ -64,18 +65,18 @@
    public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
    {
       if(resource instanceof EJBResource == false)
-         throw new IllegalArgumentException("resource is not an EJBResource");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "resource is not an EJBResource");
       
       EJBResource ejbResource = (EJBResource) resource;
       
       //Get the context map
       Map<String,Object> map = resource.getMap();
       if(map == null)
-         throw new IllegalStateException("Map from the Resource is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Map from the Resource is null");
 
       this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);  
       if(this.policyRegistration == null)
-         throw new IllegalStateException("Policy Registration passed is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Policy Registration passed is null");
 
       this.callerRunAs = ejbResource.getCallerRunAsIdentity();
       this.ejbName = ejbResource.getEjbName();
@@ -83,7 +84,7 @@
       this.ejbPrincipal = ejbResource.getPrincipal();
       this.policyContextID = ejbResource.getPolicyContextID();
       if(policyContextID == null)
-         throw new IllegalStateException("Context ID is null"); 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Context ID is null"); 
       
       this.securityRoleReferences = ejbResource.getSecurityRoleReferences();
       
@@ -115,7 +116,7 @@
          
          PolicyDecisionPoint pdp = util.getPDP(policyRegistration, this.policyContextID); 
          if(pdp == null)
-            throw new IllegalStateException("PDP is null");
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "PDP is null");
          
          ResponseContext response = pdp.evaluate(requestCtx);
          result = response.getDecision() == XACMLConstants.DECISION_PERMIT ? 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/ejb/EJBXACMLUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import java.util.List;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.util.JBossXACMLUtil;
 import org.jboss.security.identity.Role;
 import org.jboss.security.identity.RoleGroup;
@@ -125,7 +126,7 @@
          Principal principal, RoleGroup callerRoles ) throws IOException
    {
       if(principal == null)
-         throw new IllegalArgumentException("principal is null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "principal is null"); 
 
       RequestContext requestCtx = RequestResponseContextFactory.createRequestCtx();
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebJACCPolicyModuleDelegate.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebJACCPolicyModuleDelegate.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebJACCPolicyModuleDelegate.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,7 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.security.authorization.Resource;
@@ -78,14 +79,14 @@
    public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
    {
       if(resource instanceof WebResource == false)
-         throw new IllegalArgumentException("resource is not a WebResource");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "resource is not a WebResource");
       
       WebResource webResource = (WebResource) resource;
       
       //Get the context map
       Map<String,Object> map = resource.getMap();
       if(map == null)
-         throw new IllegalStateException("Map from the Resource is null"); 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Map from the Resource is null"); 
       
       //Get the Request Object
       request = (HttpServletRequest) webResource.getServletRequest();
@@ -225,7 +226,7 @@
          Set<Principal> roles, String servletName)
    { 
       if(servletName == null)
-         throw new IllegalArgumentException("servletName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "servletName is null");
       
       WebRoleRefPermission perm = new WebRoleRefPermission(servletName, roleName);
       Principal[] principals = {principal}; 
@@ -287,6 +288,6 @@
       if((resourceCheck == Boolean.TRUE && userDataCheck == Boolean.TRUE && roleRefCheck == Boolean.TRUE ) 
            || (resourceCheck == Boolean.TRUE && userDataCheck == Boolean.TRUE) 
            || (userDataCheck == Boolean.TRUE && roleRefCheck == Boolean.TRUE))
-         throw new IllegalStateException("Permission checks must be different"); 
+    	  throw new IllegalStateException(ErrorCodes.INVALID_OPERATION + "Permission checks must be different"); 
    }
 }
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLPolicyModuleDelegate.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLPolicyModuleDelegate.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLPolicyModuleDelegate.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.security.authorization.Resource;
@@ -66,23 +67,23 @@
    public int authorize(Resource resource, Subject subject, RoleGroup role)
    {
       if(resource instanceof WebResource == false)
-         throw new IllegalArgumentException("resource is not a WebResource");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "resource is not a WebResource");
       
       WebResource webResource = (WebResource) resource;
       
       //Get the contextual map
       Map<String,Object> map = resource.getMap();
       if(map == null)
-         throw new IllegalStateException("Map from the Resource is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Map from the Resource is null");
     
       if(map.size() == 0)
-         throw new IllegalStateException("Map from the Resource is size zero"); 
+         throw new IllegalStateException(ErrorCodes.MISMATCH_SIZE + "Map from the Resource is size zero"); 
       
       HttpServletRequest request = (HttpServletRequest)webResource.getServletRequest();
       
       this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
       if(this.policyRegistration == null)
-         throw new IllegalStateException("PolicyRegistration passed is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "PolicyRegistration passed is null");
       this.policyContextID = webResource.getPolicyContextID();  
       
       Boolean userDataCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.USERDATA_PERM_CHECK));
@@ -93,7 +94,7 @@
          return AuthorizationContext.PERMIT; //Base class decision holds good
       
       if(request == null)
-         throw new IllegalStateException("Request is null"); 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Request is null"); 
       
       return process(request, role);
    } 
@@ -120,7 +121,7 @@
    { 
       Principal userP = request.getUserPrincipal();
       if(userP == null)
-         throw new IllegalStateException("User Principal is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "User Principal is null");
       
       int result = AuthorizationContext.DENY;
       WebXACMLUtil util = new WebXACMLUtil();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/modules/web/WebXACMLUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -30,6 +30,7 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.util.JBossXACMLUtil;
 import org.jboss.security.identity.Role;
 import org.jboss.security.identity.RoleGroup;
@@ -63,9 +64,9 @@
          RoleGroup callerRoles) throws Exception
    { 
       if(request == null)
-         throw new IllegalArgumentException("Http Request is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Http Request is null");
       if(callerRoles == null)
-         throw new IllegalArgumentException("roles is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "roles is null");
       String httpMethod = request.getMethod();
       String action = "GET".equals(httpMethod) ? "read" : "write";
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/util/JBossXACMLUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/util/JBossXACMLUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/util/JBossXACMLUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.security.xacml.core.JBossPDP;
 import org.jboss.security.xacml.interfaces.PolicyDecisionPoint;
@@ -63,7 +64,7 @@
          Set<XACMLPolicy> policies = (Set<XACMLPolicy>)policyRegistration.getPolicy(contextID,
                PolicyRegistration.XACML, null);
          if(policies == null)
-            throw new IllegalStateException("Missing xacml policy for contextid:" + contextID);
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Missing xacml policy for contextid:" + contextID);
          JBossPolicyLocator jpl = new JBossPolicyLocator(policies);
          JBossPolicySetLocator jpsl = new JBossPolicySetLocator(policies);
          HashSet<PolicyLocator> plset = new HashSet<PolicyLocator>();

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/cache/JBossAuthenticationCache.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/cache/JBossAuthenticationCache.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/cache/JBossAuthenticationCache.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 
 import javax.security.auth.Subject;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
  
 
@@ -98,7 +99,7 @@
    {
       boolean isValid = false;
       if(!cacheHit(principal))
-         throw new SecurityCacheException("Cache Miss");
+         throw new SecurityCacheException(ErrorCodes.PROCESSING_FAILED + "Cache Miss");
       Object cred = map.get(SecurityConstants.CREDENTIAL);
       AuthCacheObject ao = cacheMap.get(principal);
       Object cacheCred = ao.credential;
@@ -157,7 +158,7 @@
       }
       
       if(!isValid)
-         throw new SecurityCacheException("Cache Validation Failed"); 
+         throw new SecurityCacheException(ErrorCodes.PROCESSING_FAILED + "Cache Validation Failed"); 
    }  
 
    /**

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/client/JBossSecurityClient.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/client/JBossSecurityClient.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/client/JBossSecurityClient.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityContextAssociation;
 import org.jboss.security.SecurityContextFactory;
@@ -55,7 +56,7 @@
    @Override
    protected void peformSASLLogin()
    {
-     throw new RuntimeException("Not Implemented");
+     throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED + "Not Implemented");
    }
 
    @Override

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.login.AuthenticationInfo;
 import org.jboss.security.auth.login.BaseAuthenticationInfo;
 import org.jboss.security.auth.login.JASPIAuthenticationInfo;
@@ -69,7 +70,7 @@
    public ApplicationPolicy(String theName)
    {
       if (theName == null)
-         throw new IllegalArgumentException("name is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "name is null");
       this.name = theName;
    }
 
@@ -221,7 +222,7 @@
          return this.getRoleMappingInfo();
       if (t == Principal.class)
          return this.getPrincipalMappingInfo();
-      throw new IllegalStateException("No mapping information available for type:" + t);
+      throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "No mapping information available for type:" + t);
    }
 
    /**

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/SecurityConfiguration.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/SecurityConfiguration.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/SecurityConfiguration.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -10,6 +10,8 @@
 import java.security.spec.AlgorithmParameterSpec;
 import java.util.HashMap;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  *  Class that provides the Configuration for authentication,
  *  authorization, mapping info etc
@@ -45,7 +47,7 @@
    public static void addApplicationPolicy(ApplicationPolicy aP)
    { 
       if(aP == null)
-         throw new IllegalArgumentException("application policy is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "application policy is null");
       appPolicies.put(aP.getName(), aP);
    }
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ApplicationPolicyParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ApplicationPolicyParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ApplicationPolicyParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,7 @@
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.acl.config.ACLProviderEntry;
 import org.jboss.security.audit.config.AuditProviderEntry;
 import org.jboss.security.auth.login.AuthenticationInfo;
@@ -75,7 +76,7 @@
               case XMLStreamConstants.START_ELEMENT:  
                  StartElement appPolicyElement = (StartElement) xmlEvent;
                  if("application-policy".equals(StaxParserUtil.getStartElementName(appPolicyElement)) == false)
-                    throw new RuntimeException("<application-policy> element expected at " + 
+                    throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "<application-policy> element expected at " + 
                           StaxParserUtil.getLineColumnNumber(xmlEvent.getLocation()));
                  //We got the application-policy element. It just has one attribute "name"
                  Iterator<Attribute> attrs = appPolicyElement.getAttributes(); 
@@ -191,10 +192,13 @@
             authInfo.add(entries);
             appPolicy.setIdentityTrustInfo(authInfo); 
          } 
-         else if("application-policy".equals(elementName))
-            break; 
-         else throw new RuntimeException("Unknown element "  + elementName + " at location " + 
-               StaxParserUtil.getLineColumnNumber(xmlEvent.getLocation())); 
+         else if("application-policy".equals(elementName)){
+             break; 
+         } 
+         else {
+        	 throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "Unknown element "  + elementName + " at location " + 
+                     StaxParserUtil.getLineColumnNumber(xmlEvent.getLocation()));
+         } 
       }
    }
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationConfigParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationConfigParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -40,6 +40,7 @@
 import javax.xml.stream.events.XMLEvent;
 
 import org.jboss.security.ClientLoginModule;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.spi.BaseCertLoginModule;
 import org.jboss.security.auth.spi.CertRolesLoginModule;
 import org.jboss.security.auth.spi.DatabaseCertLoginModule;
@@ -163,7 +164,7 @@
          return LoginModuleControlFlag.OPTIONAL;
       if("requisite".equalsIgnoreCase(flag))
          return LoginModuleControlFlag.REQUISITE;
-      throw new RuntimeException(flag + " is not recognized");
+      throw new RuntimeException(ErrorCodes.WRONG_TYPE + flag + " is not recognized");
    }
    
    /**

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -39,6 +39,7 @@
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.container.config.AuthModuleEntry;
 import org.jboss.security.auth.login.JASPIAuthenticationInfo;
 import org.jboss.security.auth.login.LoginModuleStackHolder;
@@ -100,7 +101,7 @@
             if (stackHolderRefName != null)
             {
                if (holders.containsKey(stackHolderRefName) == false)
-                  throw new RuntimeException("auth-module references a login module stack that doesn't exist: "
+                  throw new RuntimeException(ErrorCodes.WRONG_TYPE + "auth-module references a login module stack that doesn't exist: "
                         + stackHolderRefName);
                entry.setLoginModuleStackHolder(holders.get(stackHolderRefName));
             }
@@ -202,7 +203,7 @@
          return LoginModuleControlFlag.OPTIONAL;
       if ("requisite".equalsIgnoreCase(flag))
          return LoginModuleControlFlag.REQUISITE;
-      throw new RuntimeException(flag + " is not recognized");
+      throw new RuntimeException(ErrorCodes.WRONG_TYPE + flag + " is not recognized");
    }
    
    /**
@@ -262,7 +263,7 @@
                if (stackHolderRefName != null)
                {
                   if (!holders.containsKey(stackHolderRefName))
-                     throw new RuntimeException("auth-module references a login module stack that doesn't exist: "
+                     throw new RuntimeException(ErrorCodes.WRONG_TYPE + "auth-module references a login module stack that doesn't exist: "
                            + stackHolderRefName);
                   entry.setLoginModuleStackHolder(holders.get(stackHolderRefName));
                }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/JavaPropertiesConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/JavaPropertiesConfigParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/JavaPropertiesConfigParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,8 @@
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  * Able to read in Java properties into module options
  * @author Anil.Saldhana at redhat.com
@@ -75,7 +77,7 @@
          
          String key = null, value = null;
          if(peekedStartElementName.contains("property") == false)
-            throw new RuntimeException("property element not found");
+            throw new RuntimeException(ErrorCodes.MISSING_VALUE + "property element not found");
          xmlEvent = xmlEventReader.nextEvent();
          peekedStartElement = (StartElement) xmlEvent;
          peekedStartElementName = StaxParserUtil.getStartElementName(peekedStartElement);
@@ -86,7 +88,7 @@
             value = xmlEventReader.getElementText();
          } else if("value".equals(peekedStartElementName))
          {
-            throw new RuntimeException("key element not found. Check order of key and value");
+            throw new RuntimeException(ErrorCodes.MISSING_VALUE + "key element not found. Check order of key and value");
          }
          props.put(key, value);
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ModuleOptionParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ModuleOptionParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/ModuleOptionParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -36,6 +36,7 @@
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.config.Element;
 
 /**
@@ -135,7 +136,7 @@
                 String nsURI = xmlStartElement.getName().getNamespaceURI();
                 ParserNamespaceSupport parser = getSupportingParser(nsURI);
                 if(parser == null)
-                   throw new RuntimeException("Unknown nsuri:" + nsURI);
+                   throw new RuntimeException(ErrorCodes.WRONG_TYPE + "Unknown nsuri:" + nsURI);
                 return parser.parse(xmlEventReader); 
           }
       } 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxBasedConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxBasedConfigParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxBasedConfigParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -42,6 +42,7 @@
 import javax.xml.validation.Validator;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.config.ApplicationPolicy;
 import org.jboss.security.config.ApplicationPolicyRegistration;
 import org.jboss.security.config.Element;
@@ -87,7 +88,7 @@
    {
       Configuration config = Configuration.getConfiguration();
       if(config instanceof ApplicationPolicyRegistration == false)
-         throw new IllegalStateException("JAAS Configuration does not support application policy registration");
+         throw new IllegalStateException(ErrorCodes.WRONG_TYPE + "JAAS Configuration does not support application policy registration");
       
       ApplicationPolicyRegistration appPolicyRegistration = (ApplicationPolicyRegistration) config;
       
@@ -114,7 +115,7 @@
                //But there is no immediate need.
                StartElement policyConfigElement = (StartElement) xmlEvent;
                if("policy".equals(StaxParserUtil.getStartElementName(policyConfigElement)) == false)
-                     throw new IllegalArgumentException("<policy> root element expected at " 
+                     throw new IllegalArgumentException(ErrorCodes.PROCESSING_FAILED + "<policy> root element expected at " 
                            + StaxParserUtil.getLineColumnNumber(xmlEvent.getLocation()));
                
                ApplicationPolicyParser appPolicyParser = new ApplicationPolicyParser(); 
@@ -132,7 +133,7 @@
       Configuration config = Configuration.getConfiguration();
       if (!(config instanceof ApplicationPolicyRegistration))
       {
-         throw new IllegalStateException("JAAS Configuration does not support application policy registration");
+         throw new IllegalStateException(ErrorCodes.WRONG_TYPE + "JAAS Configuration does not support application policy registration");
       }
       
       ApplicationPolicyRegistration appPolicyRegistration = (ApplicationPolicyRegistration) config;
@@ -163,7 +164,7 @@
          ClassLoader tcl = SecurityActions.getContextClassLoader();
          URL schemaURL = tcl.getResource(schemaFile);
          if(schemaURL == null)
-            throw new RuntimeException("Cannot find schema :" + schemaFile);
+            throw new RuntimeException(ErrorCodes.MISSING_VALUE + "Cannot find schema :" + schemaFile);
          SchemaFactory schemaFactory = SchemaFactory.newInstance( "http://www.w3.org/2001/XMLSchema" );
          Schema schemaGrammar = schemaFactory.newSchema( schemaURL );
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxParserUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxParserUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/StaxParserUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -30,6 +30,8 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.StartElement;
+
+import org.jboss.security.ErrorCodes;
  
 
 /**
@@ -83,7 +85,7 @@
    public static final String trim(String str)
    {
       if(str == null || str.length() == 0)
-         throw new IllegalArgumentException("Input str is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Input str is null");
       return str.trim();
    }
    

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/JBossIdentityTrustContext.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/JBossIdentityTrustContext.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/JBossIdentityTrustContext.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,7 @@
 import java.util.Map;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.config.ApplicationPolicy;
 import org.jboss.security.config.ControlFlag;
@@ -101,7 +102,7 @@
       //Get the Configuration
       ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy( securityDomain);
       if(aPolicy == null)
-         throw new IllegalStateException("ApplicationPolicy not found for "+ securityDomain);
+         throw new IllegalStateException(ErrorCodes.MISSING_VALUE + "ApplicationPolicy not found for "+ securityDomain);
       
       IdentityTrustInfo iti = aPolicy.getIdentityTrustInfo();
       if(iti == null)
@@ -134,7 +135,7 @@
             log.debug("Error instantiating IdentityTrustModule:",e);
       } 
       if(im == null)
-         throw new IllegalStateException("IdentityTrustModule has not " +
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "IdentityTrustModule has not " +
                "been instantiated"); 
       im.initialize(this.securityContext, this.callbackHandler, this.sharedState,map); 
       return im;
@@ -232,7 +233,7 @@
          IdentityTrustModule module = (IdentityTrustModule)modules.get(i); 
          boolean bool = module.commit();
          if(!bool)
-            throw new IdentityTrustException("commit on modules failed");
+            throw new IdentityTrustException(ErrorCodes.PROCESSING_FAILED + "commit on modules failed");
       } 
    }
    
@@ -245,7 +246,7 @@
          IdentityTrustModule module = (IdentityTrustModule)modules.get(i); 
          boolean bool = module.abort(); 
          if(!bool)
-            throw new IdentityTrustException("abort on modules failed");
+            throw new IdentityTrustException(ErrorCodes.PROCESSING_FAILED + "abort on modules failed");
       } 
    }
 }
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/DelegatingPolicy.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/DelegatingPolicy.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/DelegatingPolicy.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -41,6 +41,7 @@
 import javax.security.jacc.WebUserDataPermission;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
  
 /**
  * A JAAC Policy provider implementation that delegates any non-JACC permissions
@@ -293,7 +294,7 @@
    {
       ContextPolicy policy = (ContextPolicy) openPolicies.get(contextID);
       if (policy == null)
-         throw new PolicyContextException("No ContextPolicy exists for contextID=" + contextID);
+         throw new PolicyContextException(ErrorCodes.NULL_VALUE + "No ContextPolicy exists for contextID=" + contextID);
       return policy;
    }
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/JBossPolicyConfiguration.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/JBossPolicyConfiguration.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/jacc/JBossPolicyConfiguration.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import javax.security.jacc.PolicyContextException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.util.state.IllegalTransitionException;
 import org.jboss.security.util.state.State;
 import org.jboss.security.util.state.StateMachine;
@@ -61,11 +62,11 @@
       this.configStateMachine = configStateMachine;
 
       if (contextID == null)
-         throw new IllegalArgumentException("contextID cannot be null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "contextID cannot be null");
       if (policy == null)
-         throw new IllegalArgumentException("policy cannot be null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "policy cannot be null");
       if (configStateMachine == null)
-         throw new IllegalArgumentException("configStateMachine cannot be null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "configStateMachine cannot be null");
 
       validateState("getPolicyConfiguration");
       trace = log.isTraceEnabled();
@@ -214,7 +215,7 @@
       catch(IllegalTransitionException e)
       {
          log.debug("validateState failure", e);
-         throw new PolicyContextException("Operation not allowed", e);
+         throw new PolicyContextException(ErrorCodes.PROCESSING_FAILED + "Operation not allowed", e);
       }
    }
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,7 @@
 import java.util.Set;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.identity.RoleGroup;
 import org.jboss.security.identity.plugins.SimpleRole;
@@ -68,7 +69,7 @@
    public void performMapping(Map<String,Object> map, RoleGroup mappedObject)
    {  
       if(map == null || map.isEmpty())
-         throw new IllegalArgumentException("Context Map is null or empty");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Context Map is null or empty");
     
       //Obtain the principal to roles mapping
       Principal principal = (Principal) map.get(SecurityConstants.PRINCIPAL_IDENTIFIER);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/MappingProviderUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/MappingProviderUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/MappingProviderUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -29,6 +29,7 @@
 import java.util.StringTokenizer;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
  
 /**
@@ -79,7 +80,7 @@
    public static String[] getRolesFromCommaSeparatedString(String str)
    {
       if(str == null)
-         throw new IllegalArgumentException("str is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "str is null");
       StringTokenizer st = new StringTokenizer(str,",");
       int numTokens = st != null ? st.countTokens() : 0;
       String[] tokens = new String[numTokens];

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/LdapAttributeMappingProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/LdapAttributeMappingProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/LdapAttributeMappingProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -40,6 +40,7 @@
 import javax.naming.ldap.InitialLdapContext;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.identity.Attribute;
 import org.jboss.security.identity.AttributeFactory;
@@ -213,12 +214,12 @@
          try
          {
             if(baseDN == null)
-               throw new NamingException(BASE_CTX_DN + " is null");
+               throw new NamingException(ErrorCodes.NULL_VALUE + BASE_CTX_DN + " is null");
             results = ctx.search(baseDN, baseFilter, filterArgs, constraints);
             if (results.hasMore() == false)
             {
                results.close();
-               throw new NamingException("Search of baseDN(" + baseDN + ") found no matches");
+               throw new NamingException(ErrorCodes.PROCESSING_FAILED + "Search of baseDN(" + baseDN + ") found no matches");
             } 
             SearchResult sr = results.next();
             String name = sr.getName();
@@ -226,7 +227,7 @@
             if (sr.isRelative() == true)
                userDN = name + "," + baseDN;
             else
-               throw new NamingException("Can't follow referal for authentication: " + name);
+               throw new NamingException(ErrorCodes.PROCESSING_FAILED + "Can't follow referal for authentication: " + name);
 
             results.close();
             

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectCNMapper.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectCNMapper.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectCNMapper.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import javax.security.auth.x500.X500Principal;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.certs.SubjectCNMapping;
 import org.jboss.security.mapping.MappingResult;
  
@@ -60,7 +61,7 @@
       if(principal instanceof X500Principal == false)
          return;
       if(contextMap == null)
-         throw new IllegalArgumentException("ContextMap is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextMap is null");
       
       X509Certificate[] certs = (X509Certificate[]) contextMap.get("X509");
       if(certs != null)

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectDNMapper.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectDNMapper.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/principal/SubjectDNMapper.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import java.util.Map;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.auth.certs.SubjectDNMapping;
 import org.jboss.security.mapping.MappingResult;
  
@@ -56,7 +57,7 @@
    public void performMapping(Map<String,Object> contextMap, Principal principal)
    {
       if(contextMap == null)
-         throw new IllegalArgumentException("ContextMap is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextMap is null");
       
       X509Certificate[] certs = (X509Certificate[]) contextMap.get("X509");
       if(certs != null)

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/DatabaseRolesMappingProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/DatabaseRolesMappingProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/DatabaseRolesMappingProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import javax.transaction.TransactionManager;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.identity.RoleGroup;
 import org.jboss.security.plugins.TransactionManagerLocator;
 
@@ -60,10 +61,10 @@
       {
          dsJndiName = (String) options.get("dsJndiName");
          if (dsJndiName == null)
-            throw new IllegalArgumentException("Datasource JNDI name can't be null");
+            throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Datasource JNDI name can't be null");
          rolesQuery = (String) options.get("rolesQuery");
          if (rolesQuery == null)
-            throw new IllegalArgumentException("Prepared statement can't be null");
+            throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Prepared statement can't be null");
          String option = (String) options.get("suspendResume");
          if (option != null)
             suspendResume = Boolean.valueOf(option.toString()).booleanValue();
@@ -79,7 +80,7 @@
          }
          catch (NamingException e)
          {
-            throw new RuntimeException("Unable to get Transaction Manager", e);
+            throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "Unable to get Transaction Manager", e);
          }
       }
    }
@@ -87,7 +88,7 @@
    public void performMapping(Map<String, Object> map, RoleGroup mappedObject)
    {
       if (map == null || map.isEmpty())
-         throw new IllegalArgumentException("Context Map is null or empty");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Context Map is null or empty");
       
       //Obtain the principal to roles mapping
       Principal principal = getCallerPrincipal(map);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/LdapRolesMappingProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/LdapRolesMappingProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/LdapRolesMappingProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -38,6 +38,7 @@
 import javax.naming.ldap.InitialLdapContext;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.Util;
 import org.jboss.security.identity.RoleGroup;
 import org.jboss.security.identity.plugins.SimpleRole;
@@ -117,7 +118,7 @@
             }
             catch (Exception e)
             {
-               throw new IllegalArgumentException("Unable to decode bindCredential", e);
+               throw new IllegalArgumentException(ErrorCodes.PROCESSING_FAILED + "Unable to decode bindCredential", e);
             }
          }
          roleFilter = (String) options.get(ROLE_FILTER_OPT);
@@ -174,7 +175,7 @@
    public void performMapping(Map<String, Object> map, RoleGroup mappedObject)
    {
       if (map == null || map.isEmpty())
-         throw new IllegalArgumentException("Context Map is null or empty");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Context Map is null or empty");
 
       //Obtain the principal to roles mapping
       Principal principal = getCallerPrincipal(map);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/PropertiesRolesMappingProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/PropertiesRolesMappingProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/PropertiesRolesMappingProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,7 @@
 import java.util.Properties;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.identity.RoleGroup;
 import org.jboss.security.util.StringPropertyReplacer;
 
@@ -65,7 +66,7 @@
          }
          catch (IOException ioe)
          {
-            throw new IllegalStateException("Error loading roles properties file", ioe);
+            throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "Error loading roles properties file", ioe);
          }
       }
    }
@@ -73,7 +74,7 @@
    public void performMapping(Map<String, Object> map, RoleGroup mappedObject)
    {
       if (map == null || map.isEmpty())
-         throw new IllegalArgumentException("Context Map is null or empty");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Context Map is null or empty");
 
       //Obtain the principal to roles mapping
       Principal principal = getCallerPrincipal(map);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/SimpleRolesMappingProvider.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/SimpleRolesMappingProvider.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/SimpleRolesMappingProvider.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import java.util.Properties;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 
 /**
  * A simple {@code MappingProvider} that reads roles from the options map.
@@ -53,7 +54,7 @@
          }
          catch (IOException ioe)
          {
-            throw new IllegalStateException("Error loading roles from options", ioe);
+            throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "Error loading roles from options", ioe);
          }
       }
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/Util.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/Util.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/role/Util.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -42,6 +42,7 @@
 import javax.transaction.TransactionManager;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.identity.RoleGroup;
 import org.jboss.security.identity.plugins.SimpleRole;
 
@@ -124,7 +125,7 @@
       }
       else
       {
-         throw new IOException("Properties file " + propertiesName + " not available");
+         throw new IOException(ErrorCodes.MISSING_FILE + "Properties file " + propertiesName + " not available");
       }
       if (trace)
          log.debug("Loaded properties, keySet=" + bundle.keySet());
@@ -193,7 +194,7 @@
       if (suspendResume)
       {
          if (tm == null)
-            throw new IllegalStateException("Transaction Manager is null");
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Transaction Manager is null");
       }
       Transaction tx = null;
       if (suspendResume)
@@ -243,11 +244,11 @@
       }
       catch (NamingException ex)
       {
-         throw new IllegalArgumentException("Error looking up DataSource from: " + dsJndiName, ex);
+         throw new IllegalArgumentException(ErrorCodes.PROCESSING_FAILED + "Error looking up DataSource from: " + dsJndiName, ex);
       }
       catch (SQLException ex)
       {
-         throw new IllegalArgumentException("Query failed", ex);
+         throw new IllegalArgumentException(ErrorCodes.PROCESSING_FAILED + "Query failed", ex);
       }
       finally
       {

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/DefaultLoginConfig.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/DefaultLoginConfig.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/DefaultLoginConfig.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -40,6 +40,7 @@
 import javax.security.auth.login.Configuration;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 
 /** An mbean that uses the default JAAS login configuration file based
  implementation. 
@@ -107,7 +108,7 @@
    {
       if( name.equals("AuthConfig") )
          return getAuthConfig();
-      throw new AttributeNotFoundException(name+": is not an attribute");
+      throw new AttributeNotFoundException(ErrorCodes.WRONG_TYPE + name+": is not an attribute");
    }
 
    public AttributeList getAttributes(String[] names)
@@ -194,7 +195,7 @@
          }
       }
       else
-         throw new AttributeNotFoundException(name+": is not an attribute");      
+         throw new AttributeNotFoundException(ErrorCodes.WRONG_TYPE + name+": is not an attribute");      
    }
 
    public AttributeList setAttributes(AttributeList attributeList)

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -42,6 +42,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.AnybodyPrincipal;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.NobodyPrincipal;
 import org.jboss.security.RunAs;
 import org.jboss.security.SecurityConstants;
@@ -243,11 +244,11 @@
    public void setAuthorizationContext(AuthorizationContext ac)
    {
       if(ac == null)
-         throw new IllegalArgumentException("AuthorizationContext is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "AuthorizationContext is null");
 
       String sc = ac.getSecurityDomain();
       if(this.securityDomain.equals(sc) == false)
-         throw new IllegalArgumentException("The Security Domain "+ sc 
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "The Security Domain "+ sc 
                + " does not match with " + this.securityDomain);
       
       lock.lock();
@@ -272,7 +273,7 @@
     */
    public Group getTargetRoles(Principal targetPrincipal, Map<String,Object> contextMap)
    {
-      throw new RuntimeException("NYI");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED + "NYI");
    }
 
    //Private Methods
@@ -350,9 +351,9 @@
    private RoleGroup getCurrentRoles(Principal principal, Subject subject, SecurityContext sc)
    {
       if(subject == null)
-         throw new IllegalArgumentException("Subject passed is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Subject passed is null");
       if(sc == null)
-         throw new IllegalArgumentException("Sec Ctx sc passed is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Sec Ctx sc passed is null");
       
       Group subjectRoles = getGroupFromSubject(subject);
       
@@ -448,7 +449,7 @@
    private Group getGroupFromSubject(Subject theSubject)
    {
       if(theSubject == null)
-         throw new IllegalArgumentException("Subject is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Subject is null");
       Set<Group> subjectGroups = theSubject.getPrincipals(Group.class);
       Iterator<Group> iter = subjectGroups.iterator();
       Group roles = null;
@@ -465,7 +466,7 @@
    private RoleGroup getRoleGroup(Group roleGroup)
    {
       if(roleGroup == null)
-         throw new IllegalArgumentException("roleGroup is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "roleGroup is null");
       SimpleRoleGroup srg = new SimpleRoleGroup(roleGroup.getName());
       Enumeration<? extends Principal> principals = roleGroup.members();
       while(principals.hasMoreElements())
@@ -479,9 +480,9 @@
    private void validateResource(Resource resource)
    {
       if(resource == null)
-         throw new IllegalArgumentException("resource is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "resource is null");
       if(resource.getMap() == null)
-         throw new IllegalArgumentException("resource has null context map");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "resource has null context map");
    }
    
    private RoleGroup getEmptyRoleGroup()

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 import javax.xml.bind.JAXBElement;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.security.xacml.core.JBossPDP;
 import org.jboss.security.xacml.factories.PolicyFactory;
@@ -83,7 +84,7 @@
          }
          return (T) this.contextIdToXACMLPolicy.get(contextID);
       }
-      throw new RuntimeException("Unsupported type:" + type);
+      throw new RuntimeException(ErrorCodes.UNSUPPORTED_TYPE + "Unsupported type:" + type);
    }
 
    /**
@@ -139,7 +140,7 @@
       if (PolicyRegistration.XACML.equalsIgnoreCase(type))
       {
          if(objectModel instanceof JAXBElement == false)
-            throw new IllegalArgumentException("Unsupported model:" + objectModel);
+            throw new IllegalArgumentException(ErrorCodes.UNSUPPORTED_TYPE + "Unsupported model:" + objectModel);
          
          try
          {

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContext.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContext.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContext.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -19,6 +19,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.ISecurityManagement;
 import org.jboss.security.RunAs;
 import org.jboss.security.SecurityConstants;
@@ -126,7 +127,7 @@
          sm.checkPermission(setSecurityManagementPermission);
       
       if(ism == null)
-         throw new IllegalArgumentException("ism is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "ism is null");
       this.iSecurityManagement = ism;  
    }
   
@@ -164,7 +165,7 @@
          manager.checkPermission(setSecurityDomainPermission);
       
       if (domain == null)
-         throw new IllegalArgumentException("Security domain cannot be null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Security domain cannot be null");
       this.securityDomain = domain;
    }
 

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContextUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContextUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecurityContextUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -31,6 +31,7 @@
 
 import javax.security.auth.Subject;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.RunAs;
 import org.jboss.security.RunAsIdentity;
 import org.jboss.security.SecurityContext;
@@ -117,13 +118,13 @@
    {   
       validateSecurityContext();
       if(key == null)
-         throw new IllegalArgumentException("Key is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Key is null");
       if(obj != null)
       {
          if(RUNAS_IDENTITY_IDENTIFIER.equals(key) && obj instanceof RunAsIdentity == false)
-            throw new IllegalArgumentException("Not RunAsIdentity:"+obj); 
+            throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "Not RunAsIdentity:"+obj); 
          if(ROLES_IDENTIFIER.equals(key) &&  obj instanceof Group == false)
-            throw new IllegalArgumentException("Not Group:"+obj); 
+            throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "Not Group:"+obj); 
       }
       if(RUNAS_IDENTITY_IDENTIFIER.equals(key))
          setRunAsIdentity( (RunAsIdentity) obj);
@@ -136,7 +137,7 @@
    public <T> T remove(String key)
    { 
       if(key == null)
-         throw new IllegalArgumentException("Key is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Key is null");
       Map<String,Object> contextMap = securityContext.getData();
       if(RUNAS_IDENTITY_IDENTIFIER.equals(key))
       {
@@ -200,6 +201,6 @@
    private void validateSecurityContext()
    {
       if(securityContext == null)
-         throw new IllegalStateException("SecurityContext is null: set it on the util"); 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "SecurityContext is null: set it on the util"); 
    }
-}
+}
\ No newline at end of file

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecuritySubjectFactory.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecuritySubjectFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossSecuritySubjectFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthenticationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.ISecurityManagement;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SubjectFactory;
@@ -85,7 +86,7 @@
       {
          SubjectActions.setContextClassLoader(this.getClass().getClassLoader());
          if (!authenticationManager.isValid(principal, SubjectActions.getCredential(), subject))
-            throw new SecurityException("Unauthenticated caller:" + principal);
+            throw new SecurityException(ErrorCodes.ACCESS_DENIED + "Unauthenticated caller:" + principal);
       }
       finally
       {

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -34,7 +34,7 @@
 import javax.security.auth.message.config.ServerAuthContext;
 import javax.security.jacc.PolicyContext;
 
-import org.jboss.security.AuthenticationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.ServerAuthenticationManager;
 
 /**
@@ -77,7 +77,7 @@
          AuthConfigFactory factory = AuthConfigFactory.getFactory();
          AuthConfigProvider provider = factory.getConfigProvider(layer,appContext,null); 
          if(provider == null)
-            throw new IllegalStateException("Provider is null for "+ layer + " for "+ appContext);
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Provider is null for "+ layer + " for "+ appContext);
 
          ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer,appContext,callbackHandler);
          String authContextId = serverConfig.getAuthContextID(messageInfo);
@@ -112,7 +112,7 @@
          AuthConfigFactory factory = AuthConfigFactory.getFactory();
          AuthConfigProvider provider = factory.getConfigProvider(layer, appContext, null); 
          if(provider == null)
-            throw new IllegalStateException("Provider is null for "+ layer + " for "+ appContext);
+            throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Provider is null for "+ layer + " for "+ appContext);
 
          ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer, appContext, handler);
          String authContextId = serverConfig.getAuthContextID(messageInfo);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JaasSecurityManagerBase.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JaasSecurityManagerBase.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JaasSecurityManagerBase.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -35,6 +35,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthenticationManager;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.RealmMapping;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
@@ -280,7 +281,7 @@
    public Principal getTargetPrincipal(Principal anotherDomainPrincipal, 
          Map<String,Object> contextMap)
    {
-      throw new RuntimeException("Not implemented yet");
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED + "Not implemented yet");
    }
 
    /** Currently this simply calls defaultLogin() to do a JAAS login using the

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/authorization/JBossAuthorizationContext.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/authorization/JBossAuthorizationContext.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/authorization/JBossAuthorizationContext.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -33,6 +33,7 @@
 import javax.security.auth.callback.CallbackHandler;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.authorization.AuthorizationContext;
 import org.jboss.security.authorization.AuthorizationException;
@@ -110,12 +111,12 @@
    public void setApplicationPolicy(ApplicationPolicy aPolicy)
    {
       if (aPolicy == null)
-         throw new IllegalArgumentException("Application Policy is null:domain=" + this.securityDomainName);
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Application Policy is null:domain=" + this.securityDomainName);
       AuthorizationInfo authzInfo = aPolicy.getAuthorizationInfo();
       if (authzInfo == null)
-         throw new IllegalArgumentException("Application Policy has no AuthorizationInfo");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Application Policy has no AuthorizationInfo");
       if (!authzInfo.getName().equals(securityDomainName))
-         throw new IllegalArgumentException("Application Policy ->AuthorizationInfo:" + authzInfo.getName()
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "Application Policy ->AuthorizationInfo:" + authzInfo.getName()
                + " does not match required domain name=" + this.securityDomainName);
       this.applicationPolicy = aPolicy;
    }
@@ -157,7 +158,7 @@
                if (result == DENY)
                {
                   invokeAbort( modules, controlFlags );
-                  throw new AuthorizationException("Denied");
+                  throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "Denied");
                }
                return null;
             }
@@ -187,7 +188,7 @@
    {
       AuthorizationInfo authzInfo = getAuthorizationInfo(securityDomainName, resource);
       if (authzInfo == null)
-         throw new IllegalStateException("Authorization Info is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authorization Info is null");
       AuthorizationModuleEntry[] entries = authzInfo.getAuthorizationModuleEntry();
       int len = entries != null ? entries.length : 0;
       for (int i = 0; i < len; i++)
@@ -268,11 +269,11 @@
       //All the authorization modules have been visited.
       String msg = getAdditionalErrorMessage(moduleException);
       if (encounteredRequiredError)
-         throw new AuthorizationException("Authorization Failed:" + msg);
+         throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "Authorization Failed:" + msg);
       if (overallDecision == DENY && encounteredOptionalError)
-         throw new AuthorizationException("Authorization Failed:" + msg);
+         throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "Authorization Failed:" + msg);
       if (overallDecision == DENY)
-         throw new AuthorizationException("Authorization Failed:Denied.");
+         throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "Authorization Failed:Denied.");
       return PERMIT;
    }
 
@@ -285,7 +286,7 @@
          AuthorizationModule module = (AuthorizationModule) modules.get(i);
          boolean bool = module.commit();
          if (!bool)
-            throw new AuthorizationException("commit on modules failed:" + module.getClass());
+            throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "commit on modules failed:" + module.getClass());
       }
    }
 
@@ -298,7 +299,7 @@
          AuthorizationModule module = (AuthorizationModule) modules.get(i);
          boolean bool = module.abort();
          if (!bool)
-            throw new AuthorizationException("abort on modules failed:" + module.getClass());
+            throw new AuthorizationException(ErrorCodes.ACCESS_DENIED + "abort on modules failed:" + module.getClass());
       }
    }
 
@@ -331,7 +332,7 @@
             log.debug("Error instantiating AuthorizationModule:", e);
       }
       if (am == null)
-         throw new IllegalStateException("AuthorizationModule has not " + "been instantiated");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "AuthorizationModule has not " + "been instantiated");
       am.initialize(this.authenticatedSubject, this.callbackHandler, this.sharedState, map, subjectRoles);
       return am;
    }
@@ -357,7 +358,7 @@
             aPolicy = SecurityConfiguration.getApplicationPolicy(WEB);
       }
       if (aPolicy == null)
-         throw new IllegalStateException("Application Policy is null for domain:" + domainName);
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Application Policy is null for domain:" + domainName);
 
       AuthorizationInfo ai = aPolicy.getAuthorizationInfo();
       if (ai == null)

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/identitytrust/JBossIdentityTrustManager.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/identitytrust/JBossIdentityTrustManager.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/identitytrust/JBossIdentityTrustManager.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -22,6 +22,7 @@
 package org.jboss.security.plugins.identitytrust;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.identitytrust.IdentityTrustContext;
 import org.jboss.security.identitytrust.IdentityTrustException;
@@ -52,7 +53,7 @@
    public void setIdentityTrustContext(IdentityTrustContext itc)
    {
      if(itc == null)
-        throw new IllegalArgumentException("null Identity Trust Context");
+        throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "null Identity Trust Context");
      this.identityTrustContext = itc;
    }
    
@@ -62,12 +63,12 @@
    public TrustDecision isTrusted(SecurityContext securityContext)
    {  
       if(securityContext == null)
-         throw new IllegalArgumentException("Security Context is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Security Context is null");
       if(this.identityTrustContext == null)
          this.identityTrustContext = new JBossIdentityTrustContext(securityDomain, securityContext);
       TrustDecision td = TrustDecision.NotApplicable;
       if(this.identityTrustContext == null)
-         throw new IllegalStateException("IdentityTrustContext is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "IdentityTrustContext is null");
        
       try
       {

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/EJBAuthorizationHelper.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/EJBAuthorizationHelper.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/EJBAuthorizationHelper.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.RunAs;
 import org.jboss.security.audit.AuditLevel;
 import org.jboss.security.authorization.AuthorizationContext;
@@ -72,19 +73,19 @@
          RoleGroup methodRoles)
    {
       if(ejbName == null)
-         throw new IllegalArgumentException("ejbName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ejbName is null");
       if(ejbMethod == null)
-         throw new IllegalArgumentException("ejbMethod is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ejbMethod is null");
       if(ejbCS == null)
-         throw new IllegalArgumentException("EJB CodeSource is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "EJB CodeSource is null");
       if(contextID == null)
-         throw new IllegalArgumentException("ContextID is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextID is null");
       if(callerSubject == null && callerRunAs == null)
-         throw new IllegalArgumentException("Either callerSubject or callerRunAs should be non-null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Either callerSubject or callerRunAs should be non-null"); 
 
       AuthorizationManager am = securityContext.getAuthorizationManager();
       if(am == null)
-         throw new IllegalStateException("Authorization Manager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authorization Manager is null");
 
       HashMap<String,Object> map =  new HashMap<String,Object>();
       try
@@ -153,18 +154,18 @@
       EJBResource ejbResource = (EJBResource) resource;
 
       if(roleName == null)
-         throw new IllegalArgumentException("roleName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "roleName is null");
       if( ejbResource.getEjbName() == null)
-         throw new IllegalArgumentException("ejbName is null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ejbName is null"); 
       if( ejbResource.getPolicyContextID() == null)
-         throw new IllegalArgumentException("ContextID is null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextID is null"); 
       
       AuthorizationManager am = securityContext.getAuthorizationManager();
 
       Subject callerSubject = ejbResource.getCallerSubject();
       
       if(am == null)
-         throw new IllegalStateException("AuthorizationManager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "AuthorizationManager is null");
       
       try
       {
@@ -204,17 +205,17 @@
          String contextID, Set<SecurityRoleRef> securityRoleRefs, boolean enforceEJBRestrictions)
    { 
       if(roleName == null)
-         throw new IllegalArgumentException("roleName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "roleName is null");
       if(ejbName == null)
-         throw new IllegalArgumentException("ejbName is null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ejbName is null"); 
       if(contextID == null)
-         throw new IllegalArgumentException("ContextID is null");  
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextID is null");  
 
       boolean isAuthorized = false;
       AuthorizationManager am = securityContext.getAuthorizationManager();
       
       if(am == null)
-         throw new IllegalStateException("AuthorizationManager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "AuthorizationManager is null");
       
       HashMap<String,Object> map = new HashMap<String,Object>();
 
@@ -285,7 +286,7 @@
           this.version = ejbVersion;  
       }
       else
-         throw new IllegalArgumentException("Invalid ejbVersion:" + ejbVersion);
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "Invalid ejbVersion:" + ejbVersion);
    }
 
    @Override
@@ -293,13 +294,13 @@
    throws WrongEEResourceException, MissingArgumentsException
    {
       if( resource instanceof EJBResource == false )
-        throw new WrongEEResourceException( "resource is not of type EJBResource" );
+        throw new WrongEEResourceException( ErrorCodes.WRONG_TYPE + "resource is not of type EJBResource" );
       EJBResource ejbResource = (EJBResource) resource;
       validateEJBResource( ejbResource );
       
       AuthorizationManager am = securityContext.getAuthorizationManager();
       if(am == null)
-         throw new IllegalStateException("Authorization Manager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authorization Manager is null");
 
       try
       {
@@ -342,15 +343,15 @@
    private void validateEJBResource( EJBResource ejbResource ) throws MissingArgumentsException
    {
       if( ejbResource.getEjbName() == null )
-         throw new MissingArgumentsException( "ejbName is null" );
+         throw new MissingArgumentsException( ErrorCodes.NULL_ARGUMENT + "ejbName is null" );
       if( ejbResource.getEjbMethod() == null )
-         throw new MissingArgumentsException( "ejbMethod is null" );
+         throw new MissingArgumentsException( ErrorCodes.NULL_ARGUMENT + "ejbMethod is null" );
       if( ejbResource.getCodeSource() == null )
-         throw new MissingArgumentsException("EJB CodeSource is null");
+         throw new MissingArgumentsException(ErrorCodes.NULL_ARGUMENT + "EJB CodeSource is null");
       if( ejbResource.getPolicyContextID() == null )
-         throw new MissingArgumentsException("ContextID is null");
+         throw new MissingArgumentsException(ErrorCodes.NULL_ARGUMENT + "ContextID is null");
       if( ejbResource.getCallerSubject() == null && ejbResource.getCallerRunAsIdentity() == null )
-         throw new MissingArgumentsException("Either callerSubject or callerRunAs should be non-null"); 
+         throw new MissingArgumentsException(ErrorCodes.NULL_ARGUMENT + "Either callerSubject or callerRunAs should be non-null"); 
    }
   
    private PolicyRegistration getPolicyRegistrationFromJNDI() throws Exception

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/WebAuthorizationHelper.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/WebAuthorizationHelper.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/javaee/WebAuthorizationHelper.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -34,6 +34,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.AuthorizationManager;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.audit.AuditLevel;
 import org.jboss.security.authorization.AuthorizationContext;
@@ -80,18 +81,18 @@
          List<String> roles)
    {
       if(contextID == null)
-         throw new IllegalArgumentException("ContextID is null");  
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextID is null");  
       if(request == null)
-         throw new IllegalArgumentException("request is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "request is null");
       if(response == null)
-         throw new IllegalArgumentException("response is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "response is null");
       if(canonicalRequestURI == null)
-         throw new IllegalArgumentException("canonicalRequestURI is null");  
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "canonicalRequestURI is null");  
 
       AuthorizationManager authzMgr = securityContext.getAuthorizationManager();
       
       if(authzMgr == null)
-         throw new IllegalStateException("Authorization Manager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authorization Manager is null");
       
       boolean isAuthorized = false; 
 
@@ -157,16 +158,16 @@
          List<String> roles)
    {
       if(roleName == null)
-         throw new IllegalArgumentException("roleName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "roleName is null");
       if(contextID == null)
-         throw new IllegalArgumentException("ContextID is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextID is null");
       
       if(callerSubject == null)
-         throw new IllegalArgumentException("callerSubject is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "callerSubject is null");
             
       AuthorizationManager authzMgr = securityContext.getAuthorizationManager();
       if(authzMgr == null)
-         throw new IllegalStateException("Authorization Manager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authorization Manager is null");
       
       boolean hasTheRole = false;
       Map<String,Object> map =  new HashMap<String,Object>();  
@@ -233,17 +234,17 @@
          List<String> roles)
    {
       if(contextID == null)
-         throw new IllegalArgumentException("ContextID is null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ContextID is null"); 
       if(callerSubject == null)
-         throw new IllegalArgumentException("callerSubject is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "callerSubject is null");
       if(request == null)
-         throw new IllegalArgumentException("request is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "request is null");
       if(response == null)
-         throw new IllegalArgumentException("response is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "response is null");
       
       AuthorizationManager authzMgr = securityContext.getAuthorizationManager();
       if(authzMgr == null)
-         throw new IllegalStateException("Authorization Manager is null");
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Authorization Manager is null");
       
       boolean hasPerm =  false;   
       contextMap.put(ResourceKeys.POLICY_REGISTRATION, getPolicyRegistration());

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 import java.util.WeakHashMap;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityUtil;
@@ -73,7 +74,7 @@
          aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain); 
       } 
       if(aPolicy == null )
-         throw new IllegalStateException("Application Policy is null for the security domain:" 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Application Policy is null for the security domain:" 
                + securityDomain);
       
       MappingContext<T> mc = null;
@@ -104,7 +105,7 @@
          aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain); 
       } 
       if(aPolicy == null )
-         throw new IllegalStateException("Application Policy is null for the security domain:" 
+         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Application Policy is null for the security domain:" 
                + securityDomain);
       
       MappingContext<T> mc = null;

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,8 @@
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  * A helper class to locate an MBeanServer.
  *      
@@ -120,6 +122,6 @@
             return server;
          }
       }
-      throw new IllegalStateException("No 'jboss' MBeanServer found!");
+      throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "No 'jboss' MBeanServer found!");
    }   
 }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/state/xml/StateMachineParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/state/xml/StateMachineParser.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/state/xml/StateMachineParser.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -28,6 +28,7 @@
 import java.util.Iterator;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.util.state.State;
 import org.jboss.security.util.state.StateMachine;
 import org.jboss.security.util.state.Transition;
@@ -147,7 +148,7 @@
       }
 
       if (resolveFailed.length() > 0)
-         throw new Exception("Failed to resolve transition targets: " + resolveFailed);
+         throw new Exception(ErrorCodes.PROCESSING_FAILED + "Failed to resolve transition targets: " + resolveFailed);
 
       StateMachine sm = new StateMachine(states, startState, description);
       return sm;

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/xml/DOMUtils.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/xml/DOMUtils.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/xml/DOMUtils.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.util.StringPropertyReplacer;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -74,7 +75,7 @@
             }
             catch (ParserConfigurationException e)
             {
-                throw new RuntimeException("Failed to create DocumentBuilder", e);
+                throw new RuntimeException(ErrorCodes.PROCESSING_FAILED + "Failed to create DocumentBuilder", e);
             }
         }
     };
@@ -252,7 +253,7 @@
             }
 
             if (namespaceURI.equals(""))
-                throw new IllegalArgumentException("Cannot find namespace uri for: " + qualifiedName);
+                throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Cannot find namespace uri for: " + qualifiedName);
         }
 
         qname = new QName(namespaceURI, localPart, prefix);

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/CallerIdentityLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/CallerIdentityLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/CallerIdentityLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.RunAsIdentity;
 import org.jboss.security.SimplePrincipal;
 
@@ -171,7 +172,7 @@
       }
       catch (Throwable e)
       {
-         throw new LoginException("Unable to get the calling principal or its credentials for resource association");
+         throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Unable to get the calling principal or its credentials for resource association");
       }
 
       // Update userName so that getIdentity is consistent

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/ConfiguredIdentityLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/ConfiguredIdentityLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/ConfiguredIdentityLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
 
 /**
@@ -73,14 +74,14 @@
       principalName = (String) options.get("principal");
       if (principalName == null)
       {
-         throw new IllegalArgumentException("Must supply a principal name!");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Must supply a principal name!");
       }
       userName = (String) options.get("userName");
       if (userName == null)
       {
          userName = (String) options.get("username");
          if (userName == null)
-            throw new IllegalArgumentException("Must supply a user name!");
+            throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Must supply a user name!");
       }
       password = (String) options.get("password");
       if (password == null)

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/JaasSecurityDomainIdentityLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/JaasSecurityDomainIdentityLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/JaasSecurityDomainIdentityLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -35,6 +35,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
 
 /** A login module for statically defining a data source username and password
@@ -103,20 +104,20 @@
         username = (String) options.get("userName");      	
         if( username == null )
         {
-         throw new IllegalArgumentException("The user name is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The user name is a required option");
         }
      }
 
       password = (String) options.get("password");
       if( password == null )
       {
-         throw new IllegalArgumentException("The password is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The password is a required option");
       }
 
       String name = (String) options.get("jaasSecurityDomain");
       if( name == null )
       {
-         throw new IllegalArgumentException("The jaasSecurityDomain is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The jaasSecurityDomain is a required option");
       }
 
       try
@@ -125,7 +126,7 @@
       }
       catch(Exception e)
       {
-         throw new IllegalArgumentException("Invalid jaasSecurityDomain: " + e.getMessage());
+         throw new IllegalArgumentException(ErrorCodes.PROCESSING_FAILED + "Invalid jaasSecurityDomain: " + e.getMessage());
       }
    }
 
@@ -158,7 +159,7 @@
       {
          if(trace)
             log.trace("Failed to decode password", e);
-         throw new LoginException("Failed to decode password: " + e.getMessage());
+         throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to decode password: " + e.getMessage());
       }
       return true;
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/PBEIdentityLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/PBEIdentityLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/PBEIdentityLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.Base64Utils;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
 import org.jboss.security.Util;
 
@@ -124,13 +125,13 @@
         username = (String) options.get("userName");      	
         if (username == null)
         {
-         throw new IllegalArgumentException("The user name is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The user name is a required option");
         }
      }
       password = (String) options.get("password");
       if (password == null)
       {
-         throw new IllegalArgumentException("The password is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The password is a required option");
       }
       // Look for the cipher password and algo parameters
       String tmp = (String) options.get("pbepass");
@@ -186,7 +187,7 @@
       {
          if (trace)
             log.trace("Failed to decode password", e);
-         throw new LoginException("Failed to decode password: " + e.getMessage());
+         throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to decode password: " + e.getMessage());
       }
       return true;
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/SecureIdentityLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/SecureIdentityLoginModule.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/datasource/security/SecureIdentityLoginModule.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -39,6 +39,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SimplePrincipal;
 
 /** An example of how one could encrypt the database password for a jca
@@ -88,13 +89,13 @@
         username = (String) options.get("userName");      	
         if (username == null)
         {
-         throw new IllegalArgumentException("The user name is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The user name is a required option");
         }
      }
       password = (String) options.get("password");
       if (password == null)
       {
-         throw new IllegalArgumentException("The password is a required option");
+         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "The password is a required option");
       }
    }
 
@@ -127,7 +128,7 @@
       {
          if (trace)
             log.trace("Failed to decode password", e);
-         throw new LoginException("Failed to decode password: " + e.getMessage());
+         throw new LoginException(ErrorCodes.PROCESSING_FAILED + "Failed to decode password: " + e.getMessage());
       }
       return true;
    }

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/plugins/vault/PicketBoxSecurityVault.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/plugins/vault/PicketBoxSecurityVault.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/plugins/vault/PicketBoxSecurityVault.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -46,6 +46,7 @@
 import javax.crypto.spec.SecretKeySpec;
 
 import org.jboss.logging.Logger;
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.plugins.PBEUtils;
 import org.jboss.security.vault.SecurityVault;
 import org.jboss.security.vault.SecurityVaultException;
@@ -125,34 +126,34 @@
    public void init(Map<String, Object> options) throws SecurityVaultException
    {
       if(options == null)
-         throw new SecurityVaultException("Options is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_ARGUMENT + "Options is null");
       
       if(options.isEmpty())
-         throw new SecurityVaultException("Options is empty");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Options is empty");
       
       String keystoreURL = (String) options.get(KEYSTORE_URL);
       if(keystoreURL == null)
-         throw new SecurityVaultException("Null " + KEYSTORE_URL);
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Null " + KEYSTORE_URL);
       keystoreURL = StringUtil.getSystemPropertyAsString(keystoreURL);
       
       String maskedPassword = (String) options.get(KEYSTORE_PASSWORD);
       if(maskedPassword == null)
-         throw new SecurityVaultException("Null masked keystore password");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Null masked keystore password");
       if(maskedPassword.startsWith(PASS_MASK_PREFIX) == false)
-         throw new SecurityVaultException("Keystore password is not masked");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Keystore password is not masked");
    
       String salt = (String) options.get(SALT);
       if(salt == null)
-         throw new SecurityVaultException("Salt is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Salt is null");
       
       String iterationCountStr = (String) options.get(ITERATION_COUNT);
       if(iterationCountStr == null)
-         throw new SecurityVaultException("Iteration Count is not set");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Iteration Count is not set");
       int iterationCount = Integer.parseInt(iterationCountStr);
       
       String alias = (String) options.get(KEYSTORE_ALIAS);
       if(alias == null)
-         throw new SecurityVaultException("Keystore Alias is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Keystore Alias is null");
       
       String keySizeStr = (String) options.get(KEY_SIZE);
       if(keySizeStr != null)
@@ -162,17 +163,17 @@
       
       String encFileDir = (String) options.get(ENC_FILE_DIR);
       if(encFileDir == null)
-         throw new SecurityVaultException("Option ENC_FILE_DIR is missing");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Option ENC_FILE_DIR is missing");
 
       try
       {
          decodedEncFileDir = StringUtil.getSystemPropertyAsString(encFileDir);
          if(directoryExists(decodedEncFileDir) == false)
-            throw new SecurityVaultException(decodedEncFileDir + " does not exist");
+            throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + decodedEncFileDir + " does not exist");
          
          if(!(decodedEncFileDir.endsWith("/") || decodedEncFileDir.endsWith("\\")))
          {
-            throw new SecurityVaultException(decodedEncFileDir + "does not end with / or \\");
+            throw new SecurityVaultException(ErrorCodes.WRONG_FORMAT + decodedEncFileDir + "does not end with / or \\");
          }
          if(encodedFileExists(decodedEncFileDir) ==false)
          {
@@ -202,7 +203,7 @@
       }
       catch (Exception e)
       { 
-         throw new SecurityVaultException("Unable to get Keystore:",e);
+         throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Unable to get Keystore:",e);
       }
       finishedInit = true;
    }
@@ -221,20 +222,21 @@
    public byte[] handshake(Map<String, Object> handshakeOptions) throws SecurityVaultException
    {
       if(handshakeOptions == null)
-         throw new SecurityVaultException("Options is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_ARGUMENT + "Options is null");
       
       if(handshakeOptions.isEmpty())
-         throw new SecurityVaultException("Options is empty");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Options is empty");
       
       String publicCert = (String) handshakeOptions.get(PUBLIC_CERT);
       if(publicCert == null)
-         throw new SecurityVaultException("Public Cert Alias is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Public Cert Alias is null");
       
       try
       {
          PublicKey publicKey = KeyStoreUtil.getPublicKey(keystore, publicCert, keyStorePWD);
          if(publicKey == null)
-            throw new SecurityVaultException("Could not retrieve Public Key from KeyStore for alias:" + publicCert);
+            throw new SecurityVaultException(ErrorCodes.NULL_VALUE + 
+            		"Could not retrieve Public Key from KeyStore for alias:" + publicCert);
           
       }
       catch (Exception e)
@@ -268,9 +270,9 @@
    {
       
       if(StringUtil.isNullOrEmpty(vaultBlock))
-         throw new SecurityVaultException("vaultBlock is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "vaultBlock is null");
       if(StringUtil.isNullOrEmpty(attributeName))
-         throw new SecurityVaultException("attributeName is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "attributeName is null");
       
       String mapKey = vaultBlock + "_" + attributeName;
       
@@ -283,7 +285,7 @@
       int index = decodedSharedKey.indexOf(LINE_BREAK);
       
       if(index < 0)
-         throw new SecurityVaultException("Shared Key is invalid");
+         throw new SecurityVaultException(ErrorCodes.MISMATCH_SIZE + "Shared Key is invalid");
       
       String alias = decodedSharedKey.substring(index + LINE_BREAK.length());
       
@@ -294,7 +296,7 @@
       }
       catch (KeyStoreException e1)
       { 
-         throw new SecurityVaultException("Cannot get certificate:",e1);
+         throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Cannot get certificate:",e1);
       }
       
       EncryptionUtil util = new EncryptionUtil(encryptionAlgorithm,keySize);
@@ -308,7 +310,7 @@
       }
       catch (Exception e1)
       { 
-         throw new SecurityVaultException("Unable to encrypt data:",e1);
+         throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Unable to encrypt data:",e1);
       }
       try
       {
@@ -316,7 +318,7 @@
       }
       catch (IOException e)
       { 
-         throw new SecurityVaultException("Unable to write Shared Key File");
+         throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Unable to write Shared Key File");
       }
       try
       {
@@ -324,7 +326,7 @@
       }
       catch (IOException e)
       { 
-         throw new SecurityVaultException("Unable to write Encoded File");
+         throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Unable to write Encoded File");
       }
    }
 
@@ -334,9 +336,9 @@
    public char[] retrieve(String vaultBlock, String attributeName, byte[] sharedKey) throws SecurityVaultException
    {
       if(StringUtil.isNullOrEmpty(vaultBlock))
-         throw new SecurityVaultException("vaultBlock is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_ARGUMENT + "vaultBlock is null");
       if(StringUtil.isNullOrEmpty(attributeName))
-         throw new SecurityVaultException("attributeName is null");
+         throw new SecurityVaultException(ErrorCodes.NULL_ARGUMENT + "attributeName is null");
       
       String mapKey = vaultBlock + "_" + attributeName;
       byte[] encryptedValue = theContent.get(mapKey);
@@ -346,7 +348,8 @@
       
       boolean matches = Arrays.equals(sharedKey, fromMap);
       if(matches == false)
-         throw new SecurityVaultException("Shared Key does not match for vault block:" + vaultBlock + " and attributeName:" + attributeName);
+         throw new SecurityVaultException(ErrorCodes.VAULT_MISMATCH + 
+        		 "Shared Key does not match for vault block:" + vaultBlock + " and attributeName:" + attributeName);
       
       byte[] secretKey = theContent.get(ADMIN_KEY);
        
@@ -358,7 +361,7 @@
       }
       catch (Exception e)
       { 
-         throw new SecurityVaultException("Decryption of value failed:",e);
+         throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Decryption of value failed:",e);
       } 
    }
    /**

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/KeyStoreUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/KeyStoreUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/KeyStoreUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -37,6 +37,8 @@
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.cert.Certificate;
+
+import org.jboss.security.ErrorCodes;
  
 
 /**
@@ -71,7 +73,7 @@
    public static KeyStore getKeyStore(String fileURL, char[] storePass) throws GeneralSecurityException, IOException
    {
       if (fileURL == null)
-         throw new IllegalArgumentException( "Null fileURL");
+         throw new IllegalArgumentException( ErrorCodes.NULL_ARGUMENT + "Null fileURL");
 
       File file = new File(fileURL);
       FileInputStream fis = new FileInputStream(file);
@@ -89,7 +91,7 @@
    public static KeyStore getKeyStore(URL url, char[] storePass) throws GeneralSecurityException, IOException
    {
       if (url == null)
-         throw new IllegalArgumentException("Null url");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Null url");
 
       return getKeyStore(url.openStream(), storePass);
    }
@@ -108,7 +110,7 @@
          IOException
    {
       if (ksStream == null)
-         throw new IllegalArgumentException( "Null InputStream for the KeyStore");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Null InputStream for the KeyStore");
       KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
       ks.load(ksStream, storePass);
       return ks;

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/StringUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/StringUtil.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/picketbox/util/StringUtil.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -32,6 +32,7 @@
 import javax.crypto.spec.PBEKeySpec;
 import javax.crypto.spec.PBEParameterSpec; 
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.plugins.PBEUtils;
 
 /**
@@ -85,7 +86,7 @@
    public static String getSystemPropertyAsString(String str)
    {
       if (str == null)
-         throw new IllegalArgumentException("Null str");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "Null str");
       if (str.contains("${"))
       {
          Pattern pattern = Pattern.compile("\\$\\{([^}]+)}");
@@ -109,7 +110,7 @@
             sysPropertyValue = SecurityActions.getSystemProperty(subString, defaultValue);
             if (sysPropertyValue.isEmpty())
             {
-               throw new IllegalArgumentException("System Property missing:" + matcher.group(1));
+               throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "System Property missing:" + matcher.group(1));
             }
             matcher.appendReplacement(buffer, sysPropertyValue);
          }
@@ -128,7 +129,7 @@
    public static void match(String first, String second)
    {
       if (first.equals(second) == false)
-         throw new RuntimeException("Match failed:" + first + " and " + second);
+         throw new RuntimeException(ErrorCodes.VALUE_MISMATCH + "Match failed:" + first + " and " + second);
    }
 
    /**

Modified: trunk/security-spi/authorization/src/main/java/org/jboss/security/config/ControlFlag.java
===================================================================
--- trunk/security-spi/authorization/src/main/java/org/jboss/security/config/ControlFlag.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/authorization/src/main/java/org/jboss/security/config/ControlFlag.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -1,90 +1,91 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2007, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.security.config; 
-
-/**
- *  Control Flag for module entries
- *  @author Anil.Saldhana at redhat.com
- *  @since  Aug 2, 2007 
- *  @version $Revision$
- */
-public class ControlFlag
-{
-   private String flag;
-   public static final ControlFlag REQUIRED = new ControlFlag("REQUIRED");
-   public static final ControlFlag REQUISITE = new ControlFlag("REQUISITE");
-   public static final ControlFlag SUFFICIENT = new ControlFlag("SUFFICIENT");
-   public static final ControlFlag OPTIONAL = new ControlFlag("OPTIONAL");
-   
-   public ControlFlag(String flag)
-   { 
-      this.flag = flag;
-   }  
-   
-   /**
-    * Returns the string represented
-    * "required", "requisite" etc
-    */
-   public String toString()
-   {
-      return flag;
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if(obj instanceof ControlFlag == false)
-         return false;
-      ControlFlag objControlFlag = (ControlFlag) obj;
-      return flag.equals(objControlFlag.flag);
-   }
-
-   @Override
-   public int hashCode()
-   { 
-      return flag.hashCode();
-   } 
-   
-   /**
-    * Method that returns the correct
-    * Control flag that is associated with the
-    * argument flag, which can be (REQUIRED,
-    * REQUISITE, SUFFICIENT and OPTIONAL)
-    * @param flag
-    * @return
-    * @throws IllegalArgumentException when flag is 
-    * different from the four above
-    */
-   public static ControlFlag valueOf(String flag)
-   {
-      if("REQUIRED".equalsIgnoreCase(flag))
-         return REQUIRED;
-      if("REQUISITE".equalsIgnoreCase(flag))
-         return REQUISITE;
-      if("SUFFICIENT".equalsIgnoreCase(flag))
-         return SUFFICIENT;
-      if("OPTIONAL".equalsIgnoreCase(flag))
-         return OPTIONAL;
-      throw new IllegalArgumentException(flag + " is not recognized");
-            
-   }
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.config; 
+
+import org.jboss.security.ErrorCodes;
+
+/**
+ *  Control Flag for module entries
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Aug 2, 2007 
+ *  @version $Revision$
+ */
+public class ControlFlag
+{
+   private String flag;
+   public static final ControlFlag REQUIRED = new ControlFlag("REQUIRED");
+   public static final ControlFlag REQUISITE = new ControlFlag("REQUISITE");
+   public static final ControlFlag SUFFICIENT = new ControlFlag("SUFFICIENT");
+   public static final ControlFlag OPTIONAL = new ControlFlag("OPTIONAL");
+   
+   public ControlFlag(String flag)
+   { 
+      this.flag = flag;
+   }  
+   
+   /**
+    * Returns the string represented
+    * "required", "requisite" etc
+    */
+   public String toString()
+   {
+      return flag;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if(obj instanceof ControlFlag == false)
+         return false;
+      ControlFlag objControlFlag = (ControlFlag) obj;
+      return flag.equals(objControlFlag.flag);
+   }
+
+   @Override
+   public int hashCode()
+   { 
+      return flag.hashCode();
+   } 
+   
+   /**
+    * Method that returns the correct
+    * Control flag that is associated with the
+    * argument flag, which can be (REQUIRED,
+    * REQUISITE, SUFFICIENT and OPTIONAL)
+    * @param flag
+    * @return
+    * @throws IllegalArgumentException when flag is 
+    * different from the four above
+    */
+   public static ControlFlag valueOf(String flag)
+   {
+      if("REQUIRED".equalsIgnoreCase(flag))
+         return REQUIRED;
+      if("REQUISITE".equalsIgnoreCase(flag))
+         return REQUISITE;
+      if("SUFFICIENT".equalsIgnoreCase(flag))
+         return SUFFICIENT;
+      if("OPTIONAL".equalsIgnoreCase(flag))
+         return OPTIONAL;
+      throw new IllegalArgumentException(ErrorCodes.ILLEGAL_ARGUMENT + flag + " is not recognized");
+   }
 }
\ No newline at end of file

Added: trunk/security-spi/identity/src/main/java/org/jboss/security/ErrorCodes.java
===================================================================
--- trunk/security-spi/identity/src/main/java/org/jboss/security/ErrorCodes.java	                        (rev 0)
+++ trunk/security-spi/identity/src/main/java/org/jboss/security/ErrorCodes.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.security;
+
+/**
+ * Error Codes for PicketBox Project
+ * @author Anil Saldhana
+ * @since Oct 27, 2011
+ */
+public interface ErrorCodes 
+{
+	String ILLEGAL_ARGUMENT = "PB00001 : Illegal Argument :";
+	
+	String NOT_YET_IMPLEMENTED = "PB00002: Not Yet Implemented:";
+	
+	String FAILED_TO_OBTAIN_SHA = "PB00003: Failed to obtain SHA MessageDigest:";
+	
+	String FAILED_TO_CREATE_SECRET_KEY_SPEC = "PB00004: Failed to create SecretKeySpec from session key, msg=";
+	
+	String UNEXPECTED_EXCEPTION_CREATE_SECRET_KEY_SPEC = "PB00005: Unexpected exception during SecretKeySpec creation, msg=";
+	
+	String FAILED_TO_CREATE_SEALEDOBJECT = "PB00006: Failed to create SealedObject, msg=";
+	
+	String KEY_IS_NOT_STRING = "PB00007: key is not a String";
+	
+	String UNRECOGNIZED_CALLBACK = "PB00008: Unrecognized Callback";
+	
+	String FAILED_TO_OBTAIN_USERNAME = "PB00009: Failed to obtain username, ioe=";
+	
+	String FAILED_TO_OBTAIN_PASSWORD = "PB00010: Failed to obtain password, ioe=";
+	
+	String SECURITY_CONTEXT_NULL = "PB00011: Security context is null";
+	
+	String UNSUPPORTED_ALGO = "PB00012: Unsupported algorigthm: ";
+	
+	String UNSUPPORTED_QOP = "PB00013: Unsupported qop=";
+	
+	String NULL_ARGUMENT = "PB00014: Null Argument:";
+	
+	String NULL_VALUE = "PB00015: Null Value:";
+	
+	String WRONG_TYPE = "PB00016: Wrong Type:";
+	
+	String MISMATCH_SIZE = "PB00017: Mismatch in size:";
+	
+	String CANNOT_REGISTER_PROVIDER = "PB00018: Cannot register Provider:";
+	
+	String PROCESSING_FAILED = "PB00019: Processing Failed:";
+	
+	String WRONG_VALUE = "PB00020: Wrong Value:";
+	
+	String INVALID_OPERATION = "PB00021: Invalid Operation:";
+	
+	String MISSING_VALUE = "PB00022: Missing Value:";
+
+	String MISSING_FILE = "PB00023: Missing File:";
+	
+	String ACCESS_DENIED = "PB00024: Access Denied:";
+	
+	String UNSUPPORTED_TYPE = "PB00025: Unsupported Type:";
+
+	String WRONG_FORMAT = "PB00026: Wrong Format:";
+
+	String VAULT_MISMATCH = "PB00027: Vault Mismatch:";
+
+	String VALUE_MISMATCH = "PB00028: Match of values failed:";
+}
\ No newline at end of file

Modified: trunk/security-spi/identity/src/main/java/org/jboss/security/identity/IdentityFactory.java
===================================================================
--- trunk/security-spi/identity/src/main/java/org/jboss/security/identity/IdentityFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/identity/src/main/java/org/jboss/security/identity/IdentityFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -24,6 +24,7 @@
 import java.security.Principal;
 import java.security.cert.X509Certificate;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.identity.extensions.CertificateIdentityFactory;
 import org.jboss.security.identity.extensions.CredentialIdentityFactory;
  
@@ -43,7 +44,7 @@
       if(type == IdentityType.CERTIFICATE)
          return  CertificateIdentityFactory.getInstance();
       
-      throw new RuntimeException("Not Yet Implemented:"+type.name());
+      throw new RuntimeException(ErrorCodes.NOT_YET_IMPLEMENTED + type.name());
    } 
    
    public static Identity getIdentity( Principal principal, Object credential )

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextAssociation.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextAssociation.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextAssociation.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -233,7 +233,7 @@
          sm.checkPermission(GetContextInfo);
 
       if (key == null)
-         throw new IllegalArgumentException("key is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "key is null");
       //SECURITY-459 get it from the current security context
       SecurityContext sc = getSecurityContext();
       if (sc != null)

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextFactory.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/SecurityContextFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -131,9 +131,9 @@
          String fqnClass, ClassLoader classLoader) throws Exception
    {
       if(securityDomain == null)
-         throw new IllegalArgumentException("securityDomain is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "securityDomain is null");
       if(fqnClass == null)
-         throw new IllegalArgumentException("fqnClass is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "fqnClass is null");
       defaultSecurityContextClass = getContextClass(fqnClass, classLoader);
       return createSecurityContext(securityDomain, defaultSecurityContextClass);
    }
@@ -152,9 +152,9 @@
          Class<? extends SecurityContext> clazz) throws Exception
    {
       if(securityDomain == null)
-         throw new IllegalArgumentException("securityDomain is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "securityDomain is null");
       if(clazz == null)
-         throw new IllegalArgumentException("clazz is null"); 
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "clazz is null"); 
       //Get the CTR
       Constructor<? extends SecurityContext> ctr = clazz.getConstructor(new Class[]{String.class});
       return (SecurityContext) ctr.newInstance(new Object[]{securityDomain}); 

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/SubjectInfo.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/SubjectInfo.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/SubjectInfo.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -106,7 +106,7 @@
    public <T> T getIdentity(Class<T> clazz)
    {
       if( clazz == null )
-         throw new IllegalArgumentException( "clazz is null" );
+         throw new IllegalArgumentException( ErrorCodes.NULL_ARGUMENT + "clazz is null" );
       if(this.identities != null)
       {
          for(Identity id:identities)
@@ -115,7 +115,7 @@
                break;
             Class<?> idClass = id.getClass();
             if( idClass == null )
-               throw new RuntimeException( id + " has null class " );
+               throw new RuntimeException( ErrorCodes.NULL_VALUE + id + " has null class " );
             if(clazz.isAssignableFrom( idClass ))
                return (T) id; 
          }

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/client/SecurityClientFactory.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/client/SecurityClientFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/client/SecurityClientFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,8 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 
+import org.jboss.security.ErrorCodes;
+
 //$Id$
 
 /**
@@ -71,7 +73,7 @@
    throws Exception 
    {
       if(SecurityClient.class.isAssignableFrom(clazz) == false)
-         throw new IllegalArgumentException("clazz is not of SecurityClient type");
+         throw new IllegalArgumentException(ErrorCodes.WRONG_TYPE + "clazz is not of SecurityClient type");
       //Use reflection to invoke the constructors
       Constructor<?> ctr = clazz.getConstructor(new Class[]{});
       return (SecurityClient) ctr.newInstance(new Object[]{});

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/AbstractJavaEEHelper.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/AbstractJavaEEHelper.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/AbstractJavaEEHelper.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -27,6 +27,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.audit.AuditEvent;
 import org.jboss.security.audit.AuditManager;
@@ -54,7 +55,7 @@
    public void setSecurityContext(SecurityContext sc)
    {
       if(sc == null)
-         throw new IllegalArgumentException("sc is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "sc is null");
       this.securityContext = sc;
    }
     

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/EJBAuthenticationHelper.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/EJBAuthenticationHelper.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/javaee/EJBAuthenticationHelper.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -26,6 +26,7 @@
 
 import javax.security.auth.Subject;
 
+import org.jboss.security.ErrorCodes;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.audit.AuditLevel;
 import org.jboss.security.identitytrust.IdentityTrustException;
@@ -43,7 +44,7 @@
    public EJBAuthenticationHelper(SecurityContext sc)
    { 
       if(sc == null)
-         throw new IllegalArgumentException("sc is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "sc is null");
       this.securityContext = sc;
    }
    
@@ -60,7 +61,7 @@
       {
          td = itm.isTrusted(securityContext);
          if(td == TrustDecision.Deny)
-            throw new IdentityTrustException("Caller denied by identity trust framework"); 
+            throw new IdentityTrustException(ErrorCodes.PROCESSING_FAILED + "Caller denied by identity trust framework"); 
       }
       return td == TrustDecision.Permit;
    }   
@@ -75,9 +76,9 @@
    public boolean isValid(Subject subject, String methodName)
    {
       if(subject == null)
-         throw new IllegalArgumentException("subject is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "subject is null");
       if(methodName == null)
-         throw new IllegalArgumentException("methodName is null");
+         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "methodName is null");
       
       Principal p = securityContext.getUtil().getUserPrincipal();
       Object cred = securityContext.getUtil().getCredential(); 

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/vault/SecurityVaultFactory.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/vault/SecurityVaultFactory.java	2011-10-07 13:12:00 UTC (rev 275)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/vault/SecurityVaultFactory.java	2011-10-28 23:19:53 UTC (rev 276)
@@ -23,6 +23,8 @@
 
 import java.util.logging.Logger;
 
+import org.jboss.security.ErrorCodes;
+
 /**
  * A factory to instantiate a {@link SecurityVault}
  * @author Anil.Saldhana at redhat.com
@@ -62,14 +64,14 @@
       {
          Class<?> vaultClass = SecurityActions.loadClass(SecurityVaultFactory.class,fqn);
          if(vaultClass == null)
-            throw new SecurityVaultException("Unable to create vault:class is null");
+            throw new SecurityVaultException(ErrorCodes.NULL_VALUE + "Unable to create vault:class is null");
          try
          {
             vault = (SecurityVault) vaultClass.newInstance();
          }
          catch (Exception e)
          {
-            throw new SecurityVaultException("Unable to create vault:not instantiated",e);
+            throw new SecurityVaultException(ErrorCodes.PROCESSING_FAILED + "Unable to create vault:not instantiated",e);
          }
       }
       return vault;



More information about the jboss-cvs-commits mailing list