MCPcopy Index your code
hub / github.com/apache/tomcat / addHostAliasImpl

Method addHostAliasImpl

java/org/apache/catalina/mapper/Mapper.java:200–226  ·  view source on GitHub ↗
(MappedHost newAlias)

Source from the content-addressed store, hash-verified

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

Callers 2

addHostMethod · 0.95
addHostAliasMethod · 0.95

Calls 9

insertMapMethod · 0.95
getRealHostNameMethod · 0.95
findMethod · 0.95
getRealHostMethod · 0.95
equalsMethod · 0.65
isDebugEnabledMethod · 0.65
debugMethod · 0.65
getStringMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected