Delegate may fail to perform the operation, which would leave
our stack inconsistent, leading to confusion if the user ignores
exceptions. Perform enter/exit on delegate first and only if it
succeeds proceed to update our stack.
Change-Id: If6ebfd9b530e9052a5dc8cab120a5d0c8317f937
Signed-off-by: Robert Varga <rovarga@cisco.com>
@Override
public void enter(@Nonnull final PathArgument child) {
checkAvailable(child);
- path.push(child);
delegate.enter(child);
+ path.push(child);
}
@Override
@Override
public void exit() {
- path.pop();
delegate.exit();
+ path.pop();
}
@Override
public void exit(final int depth) {
+ delegate.exit(depth);
for (int i = 0; i < depth; i++) {
path.pop();
}
- delegate.exit(depth);
}
@Override