{@inheritDoc} The child must be an implementation of Context .
(Container child)
| 659 | * The child must be an implementation of <code>Context</code>. |
| 660 | */ |
| 661 | @Override |
| 662 | public void addChild(Container child) { |
| 663 | |
| 664 | if (!(child instanceof Context context)) { |
| 665 | throw new IllegalArgumentException(sm.getString("standardHost.notContext")); |
| 666 | } |
| 667 | |
| 668 | child.addLifecycleListener(new MemoryLeakTrackingListener()); |
| 669 | |
| 670 | // Avoid NPE for case where Context is defined in server.xml with only a |
| 671 | // docBase |
| 672 | if (context.getPath() == null) { |
| 673 | ContextName cn = new ContextName(context.getDocBase(), true); |
| 674 | context.setPath(cn.getPath()); |
| 675 | } |
| 676 | |
| 677 | super.addChild(child); |
| 678 | |
| 679 | } |
| 680 | |
| 681 | |
| 682 | /** |
nothing calls this directly
no test coverage detected