| 375 | |
| 376 | |
| 377 | @Override |
| 378 | public NameParser getNameParser(Name name) throws NamingException { |
| 379 | |
| 380 | while ((!name.isEmpty()) && (name.get(0).isEmpty())) { |
| 381 | name = name.getSuffix(1); |
| 382 | } |
| 383 | if (name.isEmpty()) { |
| 384 | return nameParser; |
| 385 | } |
| 386 | |
| 387 | NamingEntry entry = bindings.get(name.get(0)); |
| 388 | if (entry == null) { |
| 389 | throw new NameNotFoundException(sm.getString("namingContext.nameNotBound", name, name.get(0))); |
| 390 | } |
| 391 | |
| 392 | if (entry.type != NamingEntry.CONTEXT) { |
| 393 | throw new NotContextException(sm.getString("namingContext.contextExpected", name.get(0))); |
| 394 | } |
| 395 | |
| 396 | if (name.size() > 1) { |
| 397 | return ((Context) entry.value).getNameParser(name.getSuffix(1)); |
| 398 | } |
| 399 | |
| 400 | return nameParser; |
| 401 | |
| 402 | } |
| 403 | |
| 404 | |
| 405 | @Override |