MCPcopy Create free account
hub / github.com/apache/tomcat / destroySubcontext

Method destroySubcontext

java/org/apache/naming/NamingContext.java:300–335  ·  view source on GitHub ↗
(Name name)

Source from the content-addressed store, hash-verified

298
299
300 @Override
301 public void destroySubcontext(Name name) throws NamingException {
302
303 if (!checkWritable()) {
304 return;
305 }
306
307 while ((!name.isEmpty()) && (name.get(0).isEmpty())) {
308 name = name.getSuffix(1);
309 }
310 if (name.isEmpty()) {
311 throw new NamingException(sm.getString("namingContext.invalidName"));
312 }
313
314 NamingEntry entry = bindings.get(name.get(0));
315
316 if (entry == null) {
317 throw new NameNotFoundException(sm.getString("namingContext.nameNotBound", name, name.get(0)));
318 }
319
320 if (name.size() > 1) {
321 if (entry.type == NamingEntry.CONTEXT) {
322 ((Context) entry.value).destroySubcontext(name.getSuffix(1));
323 } else {
324 throw new NamingException(sm.getString("namingContext.contextExpected", name.get(0)));
325 }
326 } else {
327 if (entry.type == NamingEntry.CONTEXT) {
328 ((Context) entry.value).close();
329 bindings.remove(name.get(0));
330 } else {
331 throw new NotContextException(sm.getString("namingContext.contextExpected", name.get(0)));
332 }
333 }
334
335 }
336
337
338 @Override

Callers

nothing calls this directly

Calls 8

checkWritableMethod · 0.95
getSuffixMethod · 0.80
getMethod · 0.65
getStringMethod · 0.65
closeMethod · 0.65
removeMethod · 0.65
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected