(MappedHost newAlias)
| 198 | } |
| 199 | |
| 200 | private synchronized boolean addHostAliasImpl(MappedHost newAlias) { |
| 201 | MappedHost[] newHosts = new MappedHost[hosts.length + 1]; |
| 202 | if (insertMap(hosts, newHosts, newAlias)) { |
| 203 | hosts = newHosts; |
| 204 | if (newAlias.name.equals(defaultHostName)) { |
| 205 | defaultHost = newAlias; |
| 206 | } |
| 207 | if (log.isDebugEnabled()) { |
| 208 | log.debug(sm.getString("mapper.addHostAlias.success", newAlias.name, newAlias.getRealHostName())); |
| 209 | } |
| 210 | return true; |
| 211 | } else { |
| 212 | MappedHost duplicate = hosts[find(hosts, newAlias.name)]; |
| 213 | if (duplicate.getRealHost() == newAlias.getRealHost()) { |
| 214 | // A duplicate Alias for the same Host. |
| 215 | // A harmless redundancy. E.g. |
| 216 | // <Host name="localhost"><Alias>localhost</Alias></Host> |
| 217 | if (log.isDebugEnabled()) { |
| 218 | log.debug(sm.getString("mapper.addHostAlias.sameHost", newAlias.name, newAlias.getRealHostName())); |
| 219 | } |
| 220 | return false; |
| 221 | } |
| 222 | log.error(sm.getString("mapper.duplicateHostAlias", newAlias.name, newAlias.getRealHostName(), |
| 223 | duplicate.getRealHostName())); |
| 224 | return false; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Remove a host alias |
no test coverage detected