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.alibaba.ims.platform.util.LicenceUtil.java

public boolean validLicence() {
    if (licence == null) {
        return false;
    }//  w w w .  ja va 2  s .  co  m

    if (isValid) {
        return true;
    }

    String decode = decode(licence);
    if (StringUtils.isBlank(decode)) {
        isValid = false;
        return isValid;
    }

    isValid = DateUtil.parse(decode.split("\\^")[1], "yyy-MM-dd").after(new Date());

    return isValid;
}

From source file:net.erdfelt.android.sdkfido.tasks.GitSwitchBranchTask.java

public GitSwitchBranchTask(IGit git, String branch) {
    this.git = git;
    this.branch = branch;
    if (StringUtils.isBlank(branch)) {
        throw new IllegalArgumentException("Branch Name cannot be blank");
    }//from  w  ww  .  j av a2  s.c  o m
}

From source file:ips1ap101.lib.core.jsf.component.Parpado.java

private boolean isRenderedTab(String tabId) {
    if (StringUtils.isBlank(tabId)) {
        return false;
    }/*from   ww w .  j  av a2s  . c om*/
    Tab tab;
    List<UIComponent> children = super.getChildren();
    for (UIComponent child : children) {
        if (child instanceof Tab) {
            tab = (Tab) child;
            if (tabId.equals(tab.getId()) && tab.isRendered()) {
                return true;
            }
        }
    }
    return false;
}

From source file:com.prowidesoftware.swift.model.field.Field97ATest.java

@Test
public void testField97AString() {
    Field97A f = null;/*from   w  ww.  j  a  v a 2  s.  co m*/

    f = new Field97A("");
    assertTrue(StringUtils.isBlank(f.getComponent1()));
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A(":");
    assertTrue(StringUtils.isBlank(f.getComponent1()));
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A("/");
    assertEquals("/", f.getComponent1());
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A("//");
    assertTrue(StringUtils.isBlank(f.getComponent1()));
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A("://");
    assertTrue(StringUtils.isBlank(f.getComponent1()));
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A(":/");
    assertEquals("/", f.getComponent1());
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A("///");
    assertEquals("/", f.getComponent2());
    assertTrue(StringUtils.isBlank(f.getComponent1()));

    f = new Field97A(":///");
    assertEquals("/", f.getComponent2());
    assertTrue(StringUtils.isBlank(f.getComponent1()));

    f = new Field97A(":abc//");
    assertEquals("abc", f.getComponent1());
    assertTrue(StringUtils.isBlank(f.getComponent2()));

    f = new Field97A(":abc//def");
    assertEquals("abc", f.getComponent1());
    assertEquals("def", f.getComponent2());

    f = new Field97A(":abc//def/ggg");
    assertEquals("abc", f.getComponent1());
    assertEquals("def/ggg", f.getComponent2());

    f = new Field97A(":abc//def/d/ggg");
    assertEquals("abc", f.getComponent1());
    assertEquals("def/d/ggg", f.getComponent2());

    f = new Field97A(":abc//def//ggg");
    assertEquals("abc", f.getComponent1());
    assertEquals("def//ggg", f.getComponent2());
}

From source file:cn.leancloud.diamond.client.processor.SnapshotConfigInfoProcessor.java

public String getConfigInfomation(String dataId, String group) throws IOException {
    if (StringUtils.isBlank(dataId)) {
        return null;
    }//from w  w w .jav a 2  s  .  c  om
    if (StringUtils.isBlank(group)) {
        return null;
    }

    String path = dir + File.separator + group;
    final File dir = new File(path);
    if (!dir.exists()) {
        return null;
    }
    String filePath = path + File.separator + dataId;
    final File file = new File(filePath);
    if (!file.exists()) {
        return null;
    }
    FileInputStream in = null;
    StringBuilder sb = new StringBuilder(512);
    try {
        in = new FileInputStream(file);
        byte[] data = new byte[8192];
        int n = -1;
        while ((n = in.read(data)) != -1) {
            sb.append(new String(data, 0, n, Constants.ENCODE));
        }
        return sb.toString();
    } finally {
        if (in != null) {
            in.close();
        }
    }

}

From source file:com.openshift.internal.restclient.model.build.WebhookTrigger.java

@Override
public String getWebhookURL() {
    if (StringUtils.isBlank(baseURL)) {
        return "";
    }//from w  w  w  .j a  va 2s.c om

    return String.format("%s/webhooks/%s/%s", baseURL, secret, type.toLowerCase());
}

From source file:de.thischwa.pmcms.tool.connection.PathConstructor.java

public PathConstructor add(final String path) {
    if (StringUtils.isBlank(path) || path.equals("" + separator))
        return this;
    if (sb.length() == 0) {
        sb.append(path);//from  w w  w .  ja v a 2 s.co  m
        return this;
    }
    String tempString;
    if (path.startsWith("" + separator))
        tempString = path.substring(1);
    else
        tempString = path;
    if (!endWithSeparator())
        sb.append(separator);
    sb.append(tempString);
    return this;
}

From source file:de.hybris.platform.acceleratorservices.dataimport.batch.converter.SequenceIdTranslator.java

@Override
public Object importValue(final String valueExpr, final Item toItem) throws JaloInvalidParameterException {
    clearStatus();/* www  .  j a v a 2s  . c  om*/
    Long result = null;
    if (!StringUtils.isBlank(valueExpr)) {
        try {
            result = Long.valueOf(valueExpr);
        } catch (final NumberFormatException exc) {
            throw new JaloInvalidParameterException(exc, 0);
        }
        if (toItem != null) {
            Long curSeqId = null;
            try {
                curSeqId = (Long) toItem.getAttribute("sequenceId");
            } catch (final JaloSecurityException e) {
                throw new SystemException("attribute sequenceId unreadable for item " + toItem.getPK(), e);
            }
            if (curSeqId != null && isInValidSequenceId(result, curSeqId)) {
                setError();
            }
        }
    }
    return result;
}

From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.SaveCartFormValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final SaveCartForm saveCartForm = (SaveCartForm) object;
    final String name = saveCartForm.getName();
    final String description = saveCartForm.getDescription();

    if (StringUtils.isBlank(name)) {
        errors.rejectValue("name", "basket.save.cart.validation.name.notBlank");
        return;/*  w ww . j  av a 2s .c om*/
    }

    if (!StringUtils.isAlphanumericSpace(name)) {
        errors.rejectValue("name", "basket.save.cart.validation.name.charset");
        return;
    }

    if (StringUtils.length(name) > 255) {
        errors.rejectValue("name", "basket.save.cart.validation.name.size");
        return;
    }

    if (StringUtils.length(description) > 255) {
        errors.rejectValue("description", "basket.save.cart.validation.description.size");
        return;
    }
}

From source file:fcl.rest.MultiPartFactory.java

@Override
public MultivaluedMap<String, String> provide() {

    Object entity = saveEntityToRequest();
    MultivaluedMap<String, String> x = new MultivaluedHashMap<>();
    FormDataMultiPart fdmp = (FormDataMultiPart) entity;
    fdmp.getFields().forEach((key, parts) -> {
        if (parts.size() == 1 && StringUtils.isBlank(parts.get(0).getContentDisposition().getFileName())) {
            x.putSingle(key, parts.get(0).getValueAs(String.class));
        }//from   w  w  w.  ja  va 2  s  . c  o  m
    });
    return x;
}