Example usage for org.apache.commons.lang3 ExtendedValidate isTrue

List of usage examples for org.apache.commons.lang3 ExtendedValidate isTrue

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ExtendedValidate isTrue.

Prototype

public static final void isTrue(boolean value, String msg, Object obj) 

Source Link

Document

Validate that the argument condition is true ; otherwise throwing an IllegalArgumentException with the specified message.

Usage

From source file:org.apache.sshd.common.file.nativefs.ExtendedNativeFileSystemFactory.java

@Override
public FileSystemView createFileSystemView(Session session) {
    String userName = session.getUsername();
    File rootDir = Validate.notNull(getSessionRootDir(session), "No root folder resolved",
            ArrayUtils.EMPTY_OBJECT_ARRAY);
    if (rootDir.exists()) {
        ExtendedValidate.isTrue(rootDir.isDirectory(), "Not a directory: %s", rootDir);
    } else if (isCreateHome()) {
        if (!rootDir.mkdirs()) {
            throw new IllegalStateException("Failed to create root directory: " + rootDir);
        }/*from   w w w .j  a v a  2 s  .  c  o  m*/

        if (logger.isDebugEnabled()) {
            logger.debug("createFileSystemView(" + userName + ") created " + rootDir);
        }
    } else {
        throw new IllegalStateException("Resolved root directory not found: " + rootDir);
    }

    return new ExtendedNativeFileSystemView(userName, rootDir, isCaseInsensitive());
}