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.mirth.connect.connectors.http.HttpListener.java

private String fixContentPath(String contextPath) {
    contextPath = StringUtils.trimToEmpty(contextPath);
    if (!contextPath.startsWith("/")) {
        contextPath = "/" + contextPath;
    }//  w w w . ja v  a2  s.  c o  m
    while (contextPath.endsWith("/") && contextPath.length() > 1) {
        contextPath = contextPath.substring(0, contextPath.length() - 1).trim();
    }
    return contextPath;
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the literateCode
 */
public String getLiterateCode() {
    return StringUtils.trimToEmpty(literateCode);
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the maritalCohabitatnHstryIndicatorVar
 *//*from  www. j  av a  2 s.  c o m*/
public String getMaritalCohabitatnHstryIndicatorVar() {
    return StringUtils.trimToEmpty(maritalCohabitatnHstryIndicatorVar);
}

From source file:net.community.chest.gitcloud.facade.frontend.git.GitController.java

private ResolvedRepositoryData resolveTargetRepository(RequestMethod method, HttpServletRequest req)
        throws IOException {
    ResolvedRepositoryData repoData = new ResolvedRepositoryData();
    String op = StringUtils.trimToEmpty(req.getParameter("service")), uriPath = req.getPathInfo();
    if (StringUtils.isEmpty(op)) {
        int pos = uriPath.lastIndexOf('/');
        if ((pos > 0) && (pos < (uriPath.length() - 1))) {
            op = uriPath.substring(pos + 1);
        }//from   w w w.  ja  v a  2 s  .  c o  m
    }

    if (!ALLOWED_SERVICES.contains(op)) {
        throw ExtendedLogUtils.thrownLogging(logger, Level.WARNING,
                "resolveTargetRepository(" + method + " " + uriPath + ")",
                new UnsupportedOperationException("Unsupported operation: " + op));
    }
    repoData.setOperation(op);

    String repoName = extractRepositoryName(uriPath);
    if (StringUtils.isEmpty(repoName)) {
        throw ExtendedLogUtils.thrownLogging(logger, Level.WARNING,
                "resolveTargetRepository(" + method + " " + uriPath + ")",
                new IllegalArgumentException("Failed to extract repo name from " + uriPath));
    }
    repoData.setRepoName(repoName);

    // TODO access an injected resolver that returns the back-end location URL
    String query = req.getQueryString();
    try {
        if (StringUtils.isEmpty(query)) {
            repoData.setRepoLocation(new URI("http://localhost:8080/git-backend/git" + uriPath));
        } else {
            repoData.setRepoLocation(new URI("http://localhost:8080/git-backend/git" + uriPath + "?" + query));
        }
    } catch (URISyntaxException e) {
        throw new MalformedURLException(e.getClass().getSimpleName() + ": " + e.getMessage());
    }

    return repoData;
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the militaryStatusCode
 */
public String getMilitaryStatusCode() {
    return StringUtils.trimToEmpty(militaryStatusCode);
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the namePrefixDescription
 */
public String getNamePrefixDescription() {
    return StringUtils.trimToEmpty(namePrefixDescription);
}

From source file:com.github.binlee1990.spider.movie.spider.MovieCrawler.java

private void setFilmDescription(Document doc, Film film) {
    String description = StringUtils.trimToEmpty(doc.select(".fm-summary").text().toString());
    film.setDescription(description);/*  w  w  w  .j  av a2 s.  c om*/
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the outstandingWarrantIndicator
 */
public String getOutstandingWarrantIndicator() {
    return StringUtils.trimToEmpty(outstandingWarrantIndicator);
}

From source file:gov.ca.cwds.data.persistence.cms.BaseClient.java

/**
 * @return the prevCaChildrenServIndicator
 */
public String getPrevCaChildrenServIndicator() {
    return StringUtils.trimToEmpty(prevCaChildrenServIndicator);
}

From source file:com.webbfontaine.valuewebb.model.util.Utils.java

public static Date localeStringToDate(String date) throws ParseException {
    if (StringUtils.trimToEmpty(date).isEmpty()) {
        return null;
    }//www.ja  v  a 2s .  c  o m
    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, LocaleSelector.instance().getLocale());
    return dateFormat.parse(date);
}