List of usage examples for javax.naming ContextNotEmptyException ContextNotEmptyException
public ContextNotEmptyException()
From source file:com.dattack.naming.AbstractContext.java
@Override public void destroySubcontext(final Name name) throws NamingException { if (name.size() > 1) { if (subContexts.containsKey(name.getPrefix(1))) { final Context subContext = subContexts.get(name.getPrefix(1)); subContext.destroySubcontext(name.getSuffix(1)); return; }// w w w .j a v a 2s .co m throw new NameNotFoundException(); } if (objectTable.containsKey(name) || !subContexts.containsKey(name)) { throw new NameNotFoundException(String.format("Context not found: %s", name)); } final Context subContext = subContexts.get(name); final NamingEnumeration<NameClassPair> names = subContext.list(""); if (names.hasMore()) { throw new ContextNotEmptyException(); } subContexts.get(name).close(); subContexts.remove(name); }