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

Method unbind

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

Source from the content-addressed store, hash-verified

187
188
189 @Override
190 public void unbind(Name name) throws NamingException {
191
192 if (!checkWritable()) {
193 return;
194 }
195
196 while ((!name.isEmpty()) && (name.get(0).isEmpty())) {
197 name = name.getSuffix(1);
198 }
199 if (name.isEmpty()) {
200 throw new NamingException(sm.getString("namingContext.invalidName"));
201 }
202
203 NamingEntry entry = bindings.get(name.get(0));
204
205 if (entry == null) {
206 throw new NameNotFoundException(sm.getString("namingContext.nameNotBound", name, name.get(0)));
207 }
208
209 if (name.size() > 1) {
210 if (entry.type == NamingEntry.CONTEXT) {
211 ((Context) entry.value).unbind(name.getSuffix(1));
212 } else {
213 throw new NamingException(sm.getString("namingContext.contextExpected", name.get(0)));
214 }
215 } else {
216 bindings.remove(name.get(0));
217 }
218
219 }
220
221
222 @Override

Callers 1

renameMethod · 0.95

Calls 8

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

Tested by

no test coverage detected