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

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

Introduction

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

Prototype

public static boolean isBlank(String str) 

Source Link

Document

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

Usage

From source file:com.salesmanager.core.util.ReferenceUtil.java

public static String getSecureDomain(MerchantStore store) {
    String domain = "localhost";
    if (store != null && !StringUtils.isBlank(store.getDomainName())) {
        domain = store.getDomainName();/*from  w  w  w  .  j a  va 2  s.  c o m*/
    }
    StringBuffer url = new StringBuffer();

    return url.append((String) conf.getString("core.domain.http.secure")).append("://").append(domain)
            .toString();
}

From source file:io.github.lucaseasedup.logit.util.Validators.java

public static boolean validateEmail(String email) {
    if (StringUtils.isBlank(email))
        return false;

    return EMAIL_PATTERN.matcher(email).matches();
}

From source file:com.aqnote.shared.cryptology.cert.util.PrivateKeyFileUtil.java

public static void writeKeyFile(String b64Key, String keyfile) throws IOException {

    if (StringUtils.isBlank(b64Key) || StringUtils.isBlank(keyfile)) {
        return;/*from ww w.  ja v a 2  s.  c  o  m*/
    }
    FileOutputStream fos2 = new FileOutputStream(keyfile);
    fos2.write(b64Key.getBytes());
    fos2.flush();
    fos2.close();
}

From source file:fr.dutra.confluence2wordpress.util.CollectionUtils.java

public static List<String> split(String str, String sep) {
    if (StringUtils.isBlank(str)) {
        return null;
    }//from w ww . j  a  va2s . c  om
    Splitter splitter = Splitter.on(sep).trimResults().omitEmptyStrings();
    List<String> list = new ArrayList<String>();
    for (String token : splitter.split(str)) {
        list.add(token);
    }
    if (list.isEmpty()) {
        return null;
    }
    return list;
}

From source file:com.baidu.rigel.biplatform.tesseract.util.String2DateUtils.java

/**
 * //from w w  w . j  av  a2s. co  m
 * ?
 * @param str 
 * @return DateFormatType
 */
public static DateFormatType dateFormatType(String str) {
    DateFormatType result = null;
    if (!StringUtils.isBlank(str)) {
        if (str.matches("[0-9]*-[0-1][0-9]-[0-3][0-9]")) {
            result = DateFormatType.DATE_FORMAT_YYYY_MM_DD;
        } else if (str.matches("[0-9]*") && str.length() == 8) {
            result = DateFormatType.DATE_FORMAT_YYYYMMDD;
        }

    }
    return result;
}

From source file:com.ms.app.web.commons.utils.DeviceUtils.java

/**
 * ?UA??//w  w  w.  j  a  v  a2s.  c  om
 * 
 * @param ua
 * @return :0 ():1
 */
public static int getDeviceByUa(String ua) {
    if (StringUtils.isBlank(ua)) {
        return 1;
    }
    ua = StringUtils.lowerCase(ua);
    // ?
    if (StringUtils.indexOfAny(ua, DEVICES) < 0) {
        return 1;
    }
    return 0;
}

From source file:com.migo.validator.Assert.java

public static void isBlank(String str, String message) {
    if (StringUtils.isBlank(str)) {
        throw new RRException(message);
    }//from  w w  w . ja  v  a2  s .  c  o  m
}

From source file:ddf.catalog.transformer.GeometryUtils.java

static Geometry parseGeometry(String wkt) throws CatalogTransformerException {
    if (StringUtils.isBlank(wkt)) {
        throw new CatalogTransformerException(
                "The metacard has no location: the overlay image cannot be rotated.");
    }//  ww w  . j  ava2s  . c o  m

    try {
        return new WKTReader().read(wkt);
    } catch (ParseException e) {
        throw new CatalogTransformerException(e);
    }
}

From source file:biz.netcentric.cq.tools.actool.validators.Validators.java

public static boolean isValidNodePath(final String path) {
    if (StringUtils.isBlank(path)) {
        return false;
    }//from  w  w w .  j  a  va  2  s.c o m
    // TO DO: proper validation
    if ((path == null) || (path.equals(""))) {
        return false;
    }
    return true;
}

From source file:com.autentia.wuija.trace.persistence.OperationalTraceBuilderForChangePassword.java

public static OperationalTrace generateOperationalTrace(String userName, OperationalTraceTypeEnum type,
        String string1, String string2) {
    if (StringUtils.isBlank(userName)) {
        throw new IllegalArgumentException("userName can not be empty or null");
    }/*  w w  w.  jav a  2 s.  co  m*/

    if (type == null) {
        throw new IllegalArgumentException("type can not be null");
    }

    return new OperationalTrace(userName, type, string1, string2 == null ? "" : string2);
}