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

项目:https-github.com-apache-zookeeper    文件:QuorumPeer.java   
public void checkAddressDuplicate(QuorumServer s) throws BadArgumentsException {
    List<InetSocketAddress> otherAddrs = new ArrayList<InetSocketAddress>();
    otherAddrs.add(s.addr);
    otherAddrs.add(s.clientAddr);
    otherAddrs.add(s.electionAddr);
    otherAddrs = excludedSpecialAddresses(otherAddrs);

    for (InetSocketAddress my: this.myAddrs) {

        for (InetSocketAddress other: otherAddrs) {
            if (my.equals(other)) {
                String error = String.format("%s of server.%d conflicts %s of server.%d", my, this.id, other, s.id);
                throw new BadArgumentsException(error);
            }
        }
    }
}
项目:https-github.com-apache-zookeeper    文件:PrepRequestProcessor.java   
private void validateCreateRequest(String path, CreateMode createMode, Request request, long ttl)
        throws KeeperException {
    try {
        EphemeralType.validateTTL(createMode, ttl);
    } catch (IllegalArgumentException e) {
        throw new BadArgumentsException(path);
    }
    if (createMode.isEphemeral()) {
        // Exception is set when local session failed to upgrade
        // so we just need to report the error
        if (request.getException() != null) {
            throw request.getException();
        }
        zks.sessionTracker.checkGlobalSession(request.sessionId,
                request.getOwner());
    } else {
        zks.sessionTracker.checkSession(request.sessionId,
                request.getOwner());
    }
}
项目:SecureKeeper    文件:QuorumPeer.java   
public void checkAddressDuplicate(QuorumServer s) throws BadArgumentsException {
    List<InetSocketAddress> otherAddrs = new ArrayList<InetSocketAddress>();
    otherAddrs.add(s.addr);
    otherAddrs.add(s.clientAddr);
    otherAddrs.add(s.electionAddr);
    otherAddrs = excludedSpecialAddresses(otherAddrs);

    for (InetSocketAddress my: this.myAddrs) {

        for (InetSocketAddress other: otherAddrs) {
            if (my.equals(other)) {
                String error = String.format("%s of server.%d conflicts %s of server.%d", my, this.id, other, s.id);
                throw new BadArgumentsException(error);
            }
        }
    }
}
项目:SecureKeeper    文件:QuorumPeer.java   
public void checkAddressDuplicate(QuorumServer s) throws BadArgumentsException {
    List<InetSocketAddress> otherAddrs = new ArrayList<InetSocketAddress>();
    otherAddrs.add(s.addr);
    otherAddrs.add(s.clientAddr);
    otherAddrs.add(s.electionAddr);
    otherAddrs = excludedSpecialAddresses(otherAddrs);

    for (InetSocketAddress my: this.myAddrs) {

        for (InetSocketAddress other: otherAddrs) {
            if (my.equals(other)) {
                String error = String.format("%s of server.%d conflicts %s of server.%d", my, this.id, other, s.id);
                throw new BadArgumentsException(error);
            }
        }
    }
}
项目:fuck_zookeeper    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path " +  path + " with session 0x" + Long.toHexString(sessionId) +
                ", reason: " + ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:https-github.com-apache-zookeeper    文件:PrepRequestProcessor.java   
/**
 * Performs basic validation of a path for a create request.
 * Throws if the path is not valid and returns the parent path.
 * @throws BadArgumentsException
 */
private String validatePathForCreate(String path, long sessionId)
        throws BadArgumentsException {
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash == -1 || path.indexOf('\0') != -1 || failCreate) {
        LOG.info("Invalid path %s with session 0x%s",
                path, Long.toHexString(sessionId));
        throw new KeeperException.BadArgumentsException(path);
    }
    return path.substring(0, lastSlash);
}
项目:https-github.com-apache-zookeeper    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path {} with session 0x{}, reason: {}",
                path, Long.toHexString(sessionId), ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:https-github.com-apache-zookeeper    文件:PrepRequestProcessor.java   
private String getParentPathAndValidate(String path)
        throws BadArgumentsException {
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash == -1 || path.indexOf('\0') != -1
            || zks.getZKDatabase().isSpecialPath(path)) {
        throw new BadArgumentsException(path);
    }
    return path.substring(0, lastSlash);
}
项目:ZooKeeper    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path " +  path + " with session 0x" + Long.toHexString(sessionId) +
                ", reason: " + ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:StreamProcessingInfrastructure    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path " +  path + " with session 0x" + Long.toHexString(sessionId) +
                ", reason: " + ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:zookeeper    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path " +  path + " with session 0x" + Long.toHexString(sessionId) +
                ", reason: " + ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
/**
 * Performs basic validation of a path for a create request.
 * Throws if the path is not valid and returns the parent path.
 * @throws BadArgumentsException
 */
private String validatePathForCreate(String path, long sessionId)
        throws BadArgumentsException {
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash == -1 || path.indexOf('\0') != -1 || failCreate) {
        LOG.info("Invalid path %s with session 0x%s",
                path, Long.toHexString(sessionId));
        throw new KeeperException.BadArgumentsException(path);
    }
    return path.substring(0, lastSlash);
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path {} with session 0x{}, reason: {}",
                path, Long.toHexString(sessionId), ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
private String getParentPathAndValidate(String path)
        throws BadArgumentsException {
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash == -1 || path.indexOf('\0') != -1
            || zks.getZKDatabase().isSpecialPath(path)) {
        throw new BadArgumentsException(path);
    }
    return path.substring(0, lastSlash);
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
/**
 * Performs basic validation of a path for a create request.
 * Throws if the path is not valid and returns the parent path.
 * @throws BadArgumentsException
 */
private String validatePathForCreate(String path, long sessionId)
        throws BadArgumentsException {
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash == -1 || path.indexOf('\0') != -1 || failCreate) {
        LOG.info("Invalid path %s with session 0x%s",
                path, Long.toHexString(sessionId));
        throw new KeeperException.BadArgumentsException(path);
    }
    return path.substring(0, lastSlash);
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
private void validatePath(String path, long sessionId) throws BadArgumentsException {
    try {
        PathUtils.validatePath(path);
    } catch(IllegalArgumentException ie) {
        LOG.info("Invalid path {} with session 0x{}, reason: {}",
                path, Long.toHexString(sessionId), ie.getMessage());
        throw new BadArgumentsException(path);
    }
}
项目:SecureKeeper    文件:PrepRequestProcessor.java   
private String getParentPathAndValidate(String path)
        throws BadArgumentsException {
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash == -1 || path.indexOf('\0') != -1
            || zks.getZKDatabase().isSpecialPath(path)) {
        throw new BadArgumentsException(path);
    }
    return path.substring(0, lastSlash);
}