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

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

Introduction

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

Prototype

public static String trimToEmpty(final String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null .

Usage

From source file:com.omertron.subbabaapi.model.SubBabaContent.java

public void setUploaderName(String uploaderName) {
    this.uploaderName = StringUtils.trimToEmpty(uploaderName);
}

From source file:com.github.benhaixiao.commons.serializer.test.EntLiveInfo.java

public void setThumb(String thumb) {
    this.thumb = StringUtils.trimToEmpty(thumb);
}

From source file:com.creditcloud.payment.model.chinapnr.MerCashRequest2.java

@Override
public String chkString() {
    StringBuilder sb = new StringBuilder(baseChkString());
    sb.append(StringUtils.trimToEmpty(getOrdId())).append(StringUtils.trimToEmpty(getUsrCustId()))
            .append(StringUtils.trimToEmpty(getTransAmt())).append(StringUtils.trimToEmpty(getServFee()))
            .append(StringUtils.trimToEmpty(getServFeeAcctId())).append(StringUtils.trimToEmpty(getRetUrl()))
            .append(StringUtils.trimToEmpty(getBgRetUrl())).append(StringUtils.trimToEmpty(getRemark()))
            .append(StringUtils.trimToEmpty(getMerPriv())).append(StringUtils.trimToEmpty(getReqExt()));
    return sb.toString();
}

From source file:ke.co.tawi.babblesms.server.beans.account.Account.java

/**
 *
 * @param logpassword
 */
public void setLogpassword(String logpassword) {
    this.logpassword = StringUtils.trimToEmpty(logpassword);
}

From source file:com.creditcloud.payment.model.chinapnr.UserRegisterRequest.java

@Override
public String chkString() {
    StringBuilder sb = new StringBuilder();
    sb.append(super.baseChkString()).append(StringUtils.trimToEmpty(BgRetUrl))
            .append(StringUtils.trimToEmpty(RetUrl)).append(StringUtils.trimToEmpty(UsrId))
            .append(StringUtils.trimToEmpty(UsrName)).append(StringUtils.trimToEmpty(IdType))
            .append(StringUtils.trimToEmpty(IdNo)).append(StringUtils.trimToEmpty(UsrMp))
            .append(StringUtils.trimToEmpty(UsrEmail)).append(StringUtils.trimToEmpty(getMerPriv()));
    return sb.toString();
}

From source file:ke.co.tawi.babblesms.server.beans.contact.Group.java

public void setAccountsuuid(String accountsuuid) {
    this.accountsuuid = StringUtils.trimToEmpty(accountsuuid);
}

From source file:com.omertron.subbabaapi.model.SubBabaContent.java

public void setUrl(String url) {
    this.url = StringUtils.trimToEmpty(url);
}

From source file:com.arrow.acs.ApiRequestSigner.java

public ApiRequestSigner parameter(String name, String value) {
    Validate.notEmpty(name, "name is empty");
    try {/*www. j  a v a2 s  .c o  m*/
        parameters.add(
                String.format("%s=%s", URLEncoder.encode(name.toLowerCase(), StandardCharsets.UTF_8.toString()),
                        StringUtils.trimToEmpty(value)));
    } catch (Exception e) {
        throw new AcsSystemException("system error", e);
    }
    return this;
}

From source file:kenh.xscript.elements.Script.java

public void process(@Attribute(ATTRIBUTE_SCRIPT_NAME) String scriptName,
        @Attribute(ATTRIBUTE_MAIN_METHOD) String main) throws UnsupportedScriptException {

    if (!this.getEnvironment().containsVariable(Constant.VARIABLE_HOME)) {
        String cur_dir = System.getProperty("user.dir");
        this.getEnvironment().setPublicVariable(Constant.VARIABLE_HOME, cur_dir, false);
    }//from  ww  w . j  a v  a 2  s .c o m

    if (StringUtils.isNotBlank(scriptName)) {
        this.name = scriptName;
        this.getEnvironment().setPublicVariable(VARIABLE_SCRIPT_NAME, name, true);
    }

    main = StringUtils.trimToEmpty(main);
    if (StringUtils.isBlank(main)) {
        main = DEFAULT_MAIN_METHOD;
    }

    this.main = main;

    processChildren();

    // find main method
    Map<String, Element> methods = this.getEnvironment().getMethods();
    Element e = methods.get(main);
    if (e == null) {
        UnsupportedScriptException ex = new UnsupportedScriptException(this,
                "Could't find the method to invoke. [" + main + "]");
        throw ex;
    }
    if (!(e instanceof Method)) {
        UnsupportedScriptException ex = new UnsupportedScriptException(this,
                "Could't find the method to invoke. [" + main + "(" + e.getClass().getCanonicalName() + ")]");
        throw ex;
    }

    int i = ((Method) e).processChildren();
    if (i != NONE && i != RETURN) {
        UnsupportedScriptException ex = new UnsupportedScriptException(this,
                "Unsupported value is returned. [" + i + "]");
        throw ex;
    }
}

From source file:com.blackducksoftware.integration.hub.detect.detector.gradle.GradleReportLine.java

public Dependency createDependencyNode(final ExternalIdFactory externalIdFactory) {
    if (!originalLine.contains(COMPONENT_PREFIX)) {
        return null;
    }//from  w ww  .j  a v  a2 s  .  c  o  m

    String cleanedOutput = StringUtils.trimToEmpty(originalLine);
    cleanedOutput = cleanedOutput
            .substring(cleanedOutput.indexOf(COMPONENT_PREFIX) + COMPONENT_PREFIX.length());

    if (cleanedOutput.endsWith(SEEN_ELSEWHERE_SUFFIX)) {
        final int lastSeenElsewhereIndex = cleanedOutput.lastIndexOf(SEEN_ELSEWHERE_SUFFIX);
        cleanedOutput = cleanedOutput.substring(0, lastSeenElsewhereIndex);
    }

    // we might need to modify the returned list, so it needs to be an actual ArrayList
    List<String> gavPieces = new ArrayList<>(Arrays.asList(cleanedOutput.split(":")));
    if (cleanedOutput.contains(WINNING_INDICATOR)) {
        // WINNING_INDICATOR can point to an entire GAV not just a version
        final String winningSection = cleanedOutput
                .substring(cleanedOutput.indexOf(WINNING_INDICATOR) + WINNING_INDICATOR.length());
        if (winningSection.contains(":")) {
            gavPieces = Arrays.asList(winningSection.split(":"));
        } else {
            // the WINNING_INDICATOR is not always preceded by a : so if isn't, we need to clean up from the original split
            if (gavPieces.get(1).contains(WINNING_INDICATOR)) {
                final String withoutWinningIndicator = gavPieces.get(1).substring(0,
                        gavPieces.get(1).indexOf(WINNING_INDICATOR));
                gavPieces.set(1, withoutWinningIndicator);
                // since there was no : we don't have a gav piece for version yet
                gavPieces.add("");
            }
            gavPieces.set(2, winningSection);
        }
    }

    if (gavPieces.size() != 3) {
        logger.error(String.format("The line can not be reasonably split in to the neccessary parts: %s",
                originalLine));
        return null;
    }

    final String group = gavPieces.get(0);
    final String artifact = gavPieces.get(1);
    final String version = gavPieces.get(2);
    final Dependency dependency = new Dependency(artifact, version,
            externalIdFactory.createMavenExternalId(group, artifact, version));
    return dependency;
}