Java 类org.apache.zookeeper.KeeperException.NotEmptyException 实例源码

项目:eZooKeeper    文件:ZooKeeperActivator.java   
public static void reportError(Throwable t) {
    Throwable cause = t.getCause();
    if (cause != null && cause != t) {
        reportError(cause);
        return;
    }

    boolean showCustomErrorMessageDialog = false;
    int style = StatusManager.LOG;
    String title = "Error";
    String message = t.getLocalizedMessage();
    if (t instanceof KeeperException) {

        KeeperException ke = (KeeperException) t;

        title = "ZooKeeper Error";
        showCustomErrorMessageDialog = true;

        if (ke instanceof InvalidACLException) {
            title = "Invalid ACL";
            message = "ACL is invalid for '" + ke.getPath() + "'.";
        }
        else if (ke instanceof NodeExistsException) {
            title = "Znode Exists";
            message = "Znode '" + ke.getPath() + "' already exists.";
        }
        else if (ke instanceof NoAuthException) {
            title = "Not Authorized";
            message = "Not authorized to perform this action on '" + ke.getPath() + "'.";
        }
        else if (ke instanceof NoNodeException) {
            title = "No Znode";
            message = "Znode '" + ke.getPath() + "' does not exist.";
        }
        else if (ke instanceof NotEmptyException) {
            title = "Not Empty";
            message = "Znode '" + ke.getPath() + "' has children.";
        }

    }

    if (showCustomErrorMessageDialog) {
        MessageDialog.openError(Display.getCurrent().getActiveShell(), title, message);
    }
    else {
        style = style | StatusManager.BLOCK;
    }

    Status status = new Status(IStatus.ERROR, PLUGIN_ID, message, t);
    StatusManager.getManager().handle(status, style);
}