remm        2003/12/23 03:09:50

  Modified:    util/java/org/apache/tomcat/util/http/mapper Mapper.java
  Log:
  - Fix host removal from the mapper (the corresponding MBean
    likely was unregistered previously).
  
  Revision  Changes    Path
  1.32      +14 -5     
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/mapper/Mapper.java
  
  Index: Mapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/mapper/Mapper.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- Mapper.java       4 Dec 2003 14:07:08 -0000       1.31
  +++ Mapper.java       23 Dec 2003 11:09:50 -0000      1.32
  @@ -154,15 +154,24 @@
        *
        * @param name Virtual host name
        */
  -    public synchronized void removeHost(String name, String[] aliases) {
  +    public synchronized void removeHost(String name) {
  +        // Find and remove the old host
  +        int pos = find(hosts, name);
  +        if (pos < 0) {
  +            return;
  +        }
  +        Object host = hosts[pos].object;
           Host[] newHosts = new Host[hosts.length - 1];
           if (removeMap(hosts, newHosts, name)) {
               hosts = newHosts;
           }
  -        for (int i = 0; i < aliases.length; i++) {
  -            newHosts = new Host[hosts.length - 1];
  -            if (removeMap(hosts, newHosts, aliases[i])) {
  -                hosts = newHosts;
  +        // Remove all aliases (they will map to the same host object)
  +        for (int i = 0; i < newHosts.length; i++) {
  +            if (newHosts[i].object == host) {
  +                Host[] newHosts2 = new Host[hosts.length - 1];
  +                if (removeMap(hosts, newHosts2, newHosts[i].name)) {
  +                    hosts = newHosts2;
  +                }
               }
           }
       }
  
  
  

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

Reply via email to