ate         2005/03/07 06:04:41

  Modified:    jetspeed-api/src/java/org/apache/jetspeed/security
                        SecurityException.java
  Log:
  Replace static String constants as exception type indicator with named 
KeyedMessage constants.
  See: http://issues.apache.org/jira/browse/JS2-219
  
  Revision  Changes    Path
  1.9       +30 -27    
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/SecurityException.java
  
  Index: SecurityException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/SecurityException.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SecurityException.java    2 Feb 2005 23:45:28 -0000       1.8
  +++ SecurityException.java    7 Mar 2005 14:04:41 -0000       1.9
  @@ -15,6 +15,7 @@
   package org.apache.jetspeed.security;
   
   import org.apache.jetspeed.exception.JetspeedException;
  +import org.apache.jetspeed.i18n.KeyedMessage;
   
   /**
    * <p>Exception throwns by members of the security service.</p>
  @@ -24,49 +25,55 @@
   public class SecurityException extends JetspeedException
   {
       /** <p>Principal does not exist exception message.</p> */
  -    public static final String PRINCIPAL_DOES_NOT_EXIST = "The principal 
does not exist.";
  +    public static final KeyedMessage PRINCIPAL_DOES_NOT_EXIST = new 
KeyedMessage("The principal {0} does not exist.");
   
       /** <p>Permission does not exist exception message.</p> */
  -    public static final String PERMISSION_DOES_NOT_EXIST = "The permission 
does not exist.";
  +    public static final KeyedMessage PERMISSION_DOES_NOT_EXIST = new 
KeyedMessage("The permission {0} does not exist.");
       
       /** <p>User principal already exists exception message.</p> */
  -    public static final String USER_ALREADY_EXISTS = "The user already 
exists.";
  +    public static final KeyedMessage USER_ALREADY_EXISTS = new 
KeyedMessage("The user {0} already exists.");
   
       /** <p>User principal does not exist exception message.</p> */
  -    public static final String USER_DOES_NOT_EXIST = "The user does not 
exist.";
  +    public static final KeyedMessage USER_DOES_NOT_EXIST = new 
KeyedMessage("The user {0} does not exist.");
   
       /** <p>Role principal already exists exception message.</p> */
  -    public static final String ROLE_ALREADY_EXISTS = "The role already 
exists.";
  +    public static final KeyedMessage ROLE_ALREADY_EXISTS = new 
KeyedMessage("The role {0} already exists.");
   
       /** <p>Role principal does not exist exception message.</p> */
  -    public static final String ROLE_DOES_NOT_EXIST = "The role does not 
exist.";
  +    public static final KeyedMessage ROLE_DOES_NOT_EXIST = new 
KeyedMessage("The role {0} does not exist.");
   
       /** <p>Group principal already exists exception message.</p> */
  -    public static final String GROUP_ALREADY_EXISTS = "The group already 
exists.";
  +    public static final KeyedMessage GROUP_ALREADY_EXISTS = new 
KeyedMessage("The group {0} already exists.");
   
       /** <p>Group principal does not exist exception message.</p> */
  -    public static final String GROUP_DOES_NOT_EXIST = "The group does not 
exist.";
  +    public static final KeyedMessage GROUP_DOES_NOT_EXIST = new 
KeyedMessage("The group {0} does not exist.");
   
       /** <p>Invalid password exception message.</p> */
  -    public static final String INVALID_PASSWORD = "Invalid password.";
  +    public static final KeyedMessage EMPTY_PARAMETER = new 
KeyedMessage("Invalid null or empty parameter {0}.");
  +
  +    /** <p>Invalid password exception message.</p> */
  +    public static final KeyedMessage INVALID_PASSWORD = new 
KeyedMessage("Invalid password.");
   
       /** <p>Invalid new password exception message.</p> */
  -    public static final String INVALID_NEW_PASSWORD = "Invalid new 
password.";
  +    public static final KeyedMessage INVALID_NEW_PASSWORD = new 
KeyedMessage("Invalid new password.");
   
       /** <p>Incorrect password exception message.</p> */
  -    public static final String INCORRECT_PASSWORD = "Incorrect password.";
  +    public static final KeyedMessage INCORRECT_PASSWORD = new 
KeyedMessage("Incorrect password.");
   
       /** <p>Password required exception message.</p> */
  -    public static final String PASSWORD_REQUIRED = "Password required.";
  +    public static final KeyedMessage PASSWORD_REQUIRED = new 
KeyedMessage("Password required.");
       
       /** <p>Invalid authentication provider exception message.</p> */
  -    public static final String INVALID_AUTHENTICATION_PROVIDER = "Invalid 
authentication provider.";    
  +    public static final KeyedMessage INVALID_AUTHENTICATION_PROVIDER = new 
KeyedMessage("Invalid authentication provider {0}.");    
   
       /** <p>Password already used exception message.</p> */
  -    public static final String PASSWORD_ALREADY_USED = "Password already 
used.";
  +    public static final KeyedMessage PASSWORD_ALREADY_USED = new 
KeyedMessage("Password already used.");
  +
  +    /** <p>The anonymous user is protected exception message.</p> */
  +    public static final KeyedMessage ANONYMOUS_USER_PROTECTED = new 
KeyedMessage("The user {0} is protected.");
   
       /** <p>The anonymous user is protected exception message.</p> */
  -    public static final String ANONYMOUS_USER_PROTECTED = "The anonymous 
user is protected.";
  +    public static final KeyedMessage UNEXPECTED = new 
KeyedMessage("Unexpected security error at {0} from {1}: {3}.");
   
       /**
        * <p>Default Constructor.</p>
  @@ -76,22 +83,18 @@
           super();
       }
   
  -    /**
  -     * <p>Constructor with exception message.</p>
  -     * @param message The exception message.
  -     */
  -    public SecurityException(String message)
  +    public SecurityException(Throwable t)
       {
  -        super(message);
  +        super(t);
       }
  -
  +    
       /**
  -     * <p>Constructor with nested exception.</p>
  -     * @param nested Nested exception.
  +     * <p>Constructor with exception message.</p>
  +     * @param message The exception message.
        */
  -    public SecurityException(Throwable nested)
  +    public SecurityException(KeyedMessage typedMessage)
       {
  -        super(nested);
  +        super(typedMessage);
       }
   
       /**
  @@ -99,7 +102,7 @@
        * @param msg The exception message.
        * @param nested Nested exception.
        */
  -    public SecurityException(String msg, Throwable nested)
  +    public SecurityException(KeyedMessage msg, Throwable nested)
       {
           super(msg, nested);
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to