Example usage for org.apache.commons.lang3 StringUtils isBlank

List of usage examples for org.apache.commons.lang3 StringUtils isBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isBlank.

Prototype

public static boolean isBlank(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is whitespace, empty ("") or null.

 StringUtils.isBlank(null)      = true StringUtils.isBlank("")        = true StringUtils.isBlank(" ")       = true StringUtils.isBlank("bob")     = false StringUtils.isBlank("  bob  ") = false 

Usage

From source file:me.leep.wf.actions.EchoAction.java

@Override
public String execute() throws Exception {
    String url = ServletActionContext.getRequest().getParameter("echo");
    System.out.println(">>>>>>>>>>>>>>>>>>>>" + url);
    if (StringUtils.isBlank(url))
        this.nextAction = "system/user-list";
    else/*from w  ww .  j  ava  2 s . c o  m*/
        this.nextAction = "system/user-list";
    //         this.nextAction = url;
    return "result";
}

From source file:com.netsteadfast.greenstep.action.utils.NormalFieldCheckUtils.java

@Override
public boolean check(String value) throws ControllerException {
    if (StringUtils.isBlank(value)) {
        return false;
    }/*w  w  w  .ja va  2 s.  co  m*/
    if (!SimpleUtils.checkBeTrueOf_azAZ09(value)) {
        return false;
    }
    return true;
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.device.FirmwareLocation.java

/**
 * Create a new instance of {@link FirmwareLocation}.
 *
 * @param protocol/*ww w.j  av a2s . c om*/
 *            the protocol to be used in the firmware URL (e.g. http, https
 *            or ftp).
 * @param domain
 *            the domain on which the firmware is located.
 * @param port
 *            the port number to be used in the firmware URL.
 * @param path
 *            the path on which the firmware is located.
 */
public FirmwareLocation(final String protocol, final String domain, final int port, final String path) {
    if (StringUtils.isBlank(domain)) {
        throw new IllegalArgumentException("Domain is empty or null.");
    }

    this.protocol = cleanUpProtocol(protocol);
    this.domain = cleanUpDomain(domain);
    this.port = port;
    this.path = cleanUpPath(path);
}

From source file:at.porscheinformatik.sonarqube.licensecheck.ValidateLicenses.java

public Set<Dependency> validateLicenses(Set<Dependency> dependencies, Project module, SensorContext context) {
    for (Dependency dependency : dependencies) {
        if (StringUtils.isBlank(dependency.getLicense())) {
            licenseNotFoundIssue(module, context, dependency);
        } else {/*from  www .  j  a v  a  2s.c om*/
            checkForLicenses(module, context, dependency);
        }
    }
    return dependencies;
}

From source file:com.dtstack.jlogstash.log.LogComponent.java

protected String checkFile() {
    String logfile = CmdLineParams.getLogFilePath();
    if (StringUtils.isBlank(logfile)) {
        return String.format("%s/%s", System.getProperty("user.dir"), "logs/jlogstash.log");
    }//from w w  w. j  a  va  2  s. c o  m
    return logfile;
}

From source file:com.examples.with.different.packagename.WordUtils.java

/**
 * <p>Checks if the String contains all words in the given array.</p>
 *
 * <p>//from w w  w . j  av a2s .c om
 * A {@code null} String will return {@code false}. A {@code null, zero
 * length search array or if one element of array is null will return {@code false}.
 * </p>
 *
 * <pre>
 * WordUtils.containsAllWords(null, *)            = false
 * WordUtils.containsAllWords("", *)              = false
 * WordUtils.containsAllWords(*, null)            = false
 * WordUtils.containsAllWords(*, [])              = false
 * WordUtils.containsAllWords("abcd", "ab", "cd") = false
 * WordUtils.containsAllWords("abc def", "def", "abc") = true
 * </pre>
 *
 *
 * @param str The str to check, may be null
 * @param words The array of String words to search for, may be null
 * @return {@code true} if all search words are found, {@code false} otherwise
 */
public static boolean containsAllWords(CharSequence word, CharSequence... words) {
    if (StringUtils.isEmpty(word) || ArrayUtils.isEmpty(words)) {
        return false;
    }
    for (CharSequence w : words) {
        if (StringUtils.isBlank(w)) {
            return false;
        }
        Pattern p = Pattern.compile(".*\\b" + w + "\\b.*");
        if (!p.matcher(word).matches()) {
            return false;
        }
    }
    return true;
}

From source file:com.log4ic.compressor.utils.template.JavascriptTemplateEngine.java

protected static String run(URI uri, String source, RunIt runIt) {
    Map<String, String> params = HttpUtils.getParameterMap(uri);
    String name;//from  www .  j a v  a  2s.  c o  m
    Mode m = null;
    if (params.containsKey("amd")) {
        name = params.get("amd");
        m = Mode.AMD;
    } else {
        name = params.get("name");
        String mode = params.get("mode");
        if (StringUtils.isBlank(name)) {
            name = uri.getPath();
            int lastI = name.lastIndexOf(".");
            name = name.substring(name.lastIndexOf("/") + 1, lastI);
        }
        if (StringUtils.isNotBlank(mode)) {
            try {
                m = Mode.valueOf(mode.toUpperCase());
            } catch (Exception e) {
                //fuck ide
            }
        }
        if (m == null) {
            m = Mode.COMMON;
        }
    }
    return runIt.run(name, source, m);
}

From source file:io.github.swagger2markup.internal.utils.MarkupDocBuilderUtils.java

public static String markupDescription(MarkupLanguage swaggerMarkupLanguage, MarkupDocBuilder markupDocBuilder,
        String markupText) {//from ww  w .ja v a 2  s.  c o  m
    if (StringUtils.isBlank(markupText)) {
        return StringUtils.EMPTY;
    }
    return copyMarkupDocBuilder(markupDocBuilder)
            .importMarkup(new StringReader(markupText), swaggerMarkupLanguage).toString().trim();
}

From source file:com.netsteadfast.greenstep.bsc.action.utils.DateDisplayFieldCheckUtils.java

@Override
public boolean check(String value) throws ControllerException {
    if (StringUtils.isBlank(value)) {
        return false;
    }//from   w  w  w. j a  va  2  s . com
    if (value.length() != 10) {
        return false;
    }
    return SimpleUtils.isDate(value);
}

From source file:com.thoughtworks.go.config.BuildArtifactConfig.java

@Override
public String getDestination() {
    return StringUtils.isBlank(destination) ? DEFAULT_ROOT.getPath()
            : FilenameUtils.separatorsToUnix(destination);
}