Buggy code:
public class InMemoryNamingStore implements NamingStore { private final InMemoryNamingStore . ContextNode root = new InMemoryNamingStore . ContextNode ( emptyName ( ) , null ) ; private transient SecurityManager securityManager ; private final NamingEventCoordinator eventCoordinator ; public InMemoryNamingStore ( ) { } public InMemoryNamingStore ( final NamingEventCoordinator eventCoordinator ) { } public void bind ( final Context callingContext , final Name name , final Object object , final String className ) throws NamingException { } public void rebind ( final Context callingContext , final Name name , final Object object , final String className ) throws NamingException { } public void unbind ( final Context callingContext , final Name name ) throws NamingException { } public Object lookup ( final Name name ) throws NamingException { } public List < NameClassPair > list ( final Name name ) throws NamingException { } public List < Binding > listBindings ( final Name name ) throws NamingException { } public Context createSubcontext ( final Context callingContext , final Name name ) throws NamingException { } public void close ( ) throws NamingException { } public void addNamingListener ( final Name target , final int scope , final NamingListener listener ) { } public void removeNamingListener ( final NamingListener listener ) { } private void fireEvent ( final Context callingContext , final Name name , final Binding existingBinding , final Binding newBinding , final int type , final String changeInfo ) { } private void checkReferenceForContinuation ( final Name name , final Object object ) throws CannotProceedException { } private void checkPermissions ( final Name name , JndiPermission . Action permission ) { } private abstract class TreeNode { protected final Name fullName ; protected final Binding binding ; private TreeNode ( final Name fullName , final Binding binding ) { } protected abstract < T > T accept ( InMemoryNamingStore . NodeVisitor < T > visitor ) throws NamingException { } } private class ContextNode extends InMemoryNamingStore . TreeNode { private volatile Map < String , InMemoryNamingStore . TreeNode > children = Collections . emptyMap ( ) ; private ContextNode ( final Name fullName , final NamingContext context ) { } private synchronized void addChild ( final String childName , final InMemoryNamingStore . TreeNode childNode ) throws NamingException { } private synchronized InMemoryNamingStore . TreeNode replaceChild ( final String childName , final InMemoryNamingStore . TreeNode childNode ) throws NamingException { } private synchronized InMemoryNamingStore . TreeNode removeChild ( final String childName ) throws NameNotFoundException { } private synchronized void clear ( ) { } protected final < T > T accept ( InMemoryNamingStore . NodeVisitor < T > visitor ) throws NamingException { } } private class BindingNode extends InMemoryNamingStore . TreeNode { private BindingNode ( final Name fullName , final Binding binding ) { } protected final < T > T accept ( InMemoryNamingStore . NodeVisitor < T > visitor ) throws NamingException { } } private interface NodeVisitor < T > { T visit ( InMemoryNamingStore . BindingNode bindingNode ) throws NamingException { } T visit ( InMemoryNamingStore . ContextNode contextNode ) throws NamingException ; } private abstract class NodeTraversingVisitor < T > implements InMemoryNamingStore . NodeVisitor < T > { private Name currentName ; protected final Name targetName ; private NodeTraversingVisitor ( final Name targetName ) { } public final T visit ( final InMemoryNamingStore . BindingNode bindingNode ) throws NamingException { } public final T visit ( final InMemoryNamingStore . ContextNode contextNode ) throws NamingException { if ( InMemoryNamingStore . NodeTraversingVisitor . isEmpty ( currentName ) ) { return found ( contextNode ) ; } final String childName = currentName . get ( 0 ) ; currentName = currentName . getSuffix ( 1 ) ; final InMemoryNamingStore . TreeNode node = contextNode . children . get ( childName ) ; if ( node == null ) { <START_BUG> throw InMemoryNamingStore . NodeTraversingVisitor . nameNotFoundException ( childName , currentName ) ; <END_BUG> } return node . accept ( this ) ; } protected abstract T found ( InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } protected abstract T found ( InMemoryNamingStore . BindingNode bindingNode ) throws NamingException { } protected T foundReferenceInsteadOfContext ( InMemoryNamingStore . BindingNode bindingNode ) throws NamingException { } } private abstract class BindingContextVisitor < T > extends InMemoryNamingStore . NodeTraversingVisitor < T > { protected final Name targetName ; private BindingContextVisitor ( final Name targetName ) { } protected final T found ( final InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } protected final T found ( final InMemoryNamingStore . BindingNode bindingNode ) throws NamingException { } protected abstract T foundBindContext ( final InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } } private final class BindVisitor extends InMemoryNamingStore . BindingContextVisitor < Void > { private final Context callingContext ; private final Object object ; private final String className ; private BindVisitor ( final Context callingContext , final Name name , final Object object , final String className ) { } protected Void foundBindContext ( InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } } private final class RebindVisitor extends InMemoryNamingStore . BindingContextVisitor < Void > { private final Context callingContext ; private final Object object ; private final String className ; private RebindVisitor ( final Context callingContext , final Name name , final Object object , final String className ) { } protected Void foundBindContext ( InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } } private final class UnbindVisitor extends InMemoryNamingStore . BindingContextVisitor < Void > { private final Context callingContext ; private UnbindVisitor ( final Context callingContext , final Name targetName ) throws NamingException { } protected Void foundBindContext ( InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } } private final class CreateSubContextVisitor extends InMemoryNamingStore . BindingContextVisitor < Context > { private final Context callingContext ; private CreateSubContextVisitor ( final Context callingContext , final Name targetName ) throws NamingException { } protected Context foundBindContext ( InMemoryNamingStore . ContextNode contextNode ) throws NamingException { } }

Fix:
throw InMemoryNamingStore . NodeTraversingVisitor . nameNotFoundException ( childName , contextNode . fullName ) ;