String container = command.getCurrentRequest().getEndpoint().getHost();
String key = command.getCurrentRequest().getEndpoint().getPath();
if (key == null || key.equals("/"))
exception = new ContainerNotFoundException(container, message);
else
exception = new KeyNotFoundException(container, key, message);
} else if (command.getCurrentRequest().getEndpoint().getPath()
.indexOf(servicePath.equals("/") ? "/" : servicePath + "/") == 0) {
String path = command.getCurrentRequest().getEndpoint().getPath().substring(servicePath.length());
List<String> parts = newArrayList(Splitter.on('/').omitEmptyStrings().split(path));
if (parts.size() == 1) {
exception = new ContainerNotFoundException(parts.get(0), message);
} else if (parts.size() > 1) {
exception = new KeyNotFoundException(parts.remove(0), Joiner.on('/').join(parts), message);
}
}
}
return exception;
default: