User: pkendall
  Date: 01/05/17 16:34:37

  Modified:    src/main/org/jbossmq/server UserManager.java
  Log:
  Throw JMSSecurityException and InvalidClientIDException's.
  Synchronize access to loddedOnClientIds set.
  
  Revision  Changes    Path
  1.4       +20 -15    jbossmq/src/main/org/jbossmq/server/UserManager.java
  
  Index: UserManager.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/server/UserManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserManager.java  2001/03/02 01:13:02     1.3
  +++ UserManager.java  2001/05/17 23:34:37     1.4
  @@ -13,12 +13,9 @@
   import java.util.Enumeration;
   
   import javax.jms.JMSException;
  +import javax.jms.JMSSecurityException;
  +import javax.jms.InvalidClientIDException;
   
  -
  -
  -
  -
  -
   import org.jbossmq.Log;
   import org.jbossmq.SpyTopic;
   import org.jbossmq.server.JMSServer;
  @@ -30,7 +27,7 @@
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    *   @author Hiram Chirino ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
    */
   public class UserManager {
   
  @@ -65,14 +62,16 @@
                                }
   
                                if( clientId != null ) {
  -                                     if (loggedOnClientIds.contains(clientId)) 
  -                                             throw new JMSException("The login id 
has an assigned client id.  That client id is already connected to the server!");
  -                                     loggedOnClientIds.add(clientId);
  +                                     synchronized(loggedOnClientIds) {
  +                                             if 
(loggedOnClientIds.contains(clientId)) 
  +                                                     throw new 
JMSSecurityException("The login id has an assigned client id.  That client id is 
already connected to the server!");
  +                                             loggedOnClientIds.add(clientId);
  +                                     }
                                }
   
                                return clientId;
                        }
  -                     throw new JMSException("This user does not exist");
  +                     throw new JMSSecurityException("This user does not exist");
                                
                }
                } catch (org.jbossmq.xml.XElementException e ) {
  @@ -221,7 +220,9 @@
        {
                                
                //Check : this ID must not be registered
  -             if (loggedOnClientIds.contains(ID)) throw new JMSException("This 
loggedOnClientIds is already registered !");
  +             synchronized(loggedOnClientIds) {
  +                     if (loggedOnClientIds.contains(ID)) throw new 
InvalidClientIDException("This loggedOnClientIds is already registered !");
  +             }
   
                //Check : this ID must not be password protected
                synchronized (userManagerConfig) {
  @@ -229,19 +230,23 @@
                        while( enum.hasMoreElements() ) {
                                XElement element = (XElement)enum.nextElement();
                                try {
  -                             if( element.containsField("Id") && 
element.getField("Id").equals( ID )  ) {
  -                                                     throw new JMSException("This 
loggedOnClientIds is password protected !");
  +                                     if( element.containsField("Id") && 
element.getField("Id").equals( ID )  ) {
  +                                                     throw new 
InvalidClientIDException("This loggedOnClientIds is password protected !");
                                }
                                } catch ( org.jbossmq.xml.XElementException ignore ) {
                                }
                        }
   
                }
  -             loggedOnClientIds.add(ID);
  +             synchronized(loggedOnClientIds) {
  +                     loggedOnClientIds.add(ID);
  +             }
        }
   
        public void removeLoggedOnClientId(String ID)
        {
  -             loggedOnClientIds.remove(ID);
  +             synchronized(loggedOnClientIds) {
  +                     loggedOnClientIds.remove(ID);
  +             }
        }
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to