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

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

Introduction

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

Prototype

public static boolean isEmpty(String str) 

Source Link

Document

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

Usage

From source file:eu.eidas.node.logging.LoggingUtil.java

public static void logServletCall(HttpServletRequest request, final String className, final Logger logger) {
    if (!StringUtils.isEmpty(request.getRemoteHost())) {
        MDC.put(LoggingMarkerMDC.MDC_REMOTE_HOST, request.getRemoteHost());
    }//w  ww  .  j  a  v  a 2s .c o  m
    MDC.put(LoggingMarkerMDC.MDC_SESSIONID, request.getSession().getId());
    logger.info(LoggingMarkerMDC.WEB_EVENT,
            "**** CALL to servlet " + className + " FROM " + request.getRemoteAddr() + " HTTP "
                    + request.getMethod() + " SESSIONID " + request.getSession().getId() + "****");

}

From source file:com.baifendian.swordfish.execserver.job.impexp.ImpExpUtil.java

/**
 * ???//from  w  w w .ja v  a  2 s.  c  o  m
 */
public static String addBackQuota(String str) {
    //??
    if (StringUtils.isEmpty(str)) {
        return str;
    }

    char first = str.charAt(0);
    if (first == '`') {
        str = "`" + str;
    }

    char last = str.charAt(str.length() - 1);
    if (last == '`') {
        str += "`";
    }
    return str;
}

From source file:com.huawei.streaming.cql.executor.ExecutorUtils.java

/**
 * ???//from w  w w . jav  a2 s .  com
 * @param str ????
 * @return ???
 */
public static String removeStreamName(String str) {
    if (StringUtils.isEmpty(str)) {
        return null;
    }
    StringBuilder sb = new StringBuilder();
    String[] fields = str.split(",");
    for (int i = 0; i < fields.length; i++) {
        String[] streamAndType = fields[i].split("\\.");
        sb.append(streamAndType[streamAndType.length - 1]);
        if (i != fields.length - 1) {
            sb.append(",");
        }
    }
    return sb.toString();
}

From source file:net.rim.ejde.internal.util.RIAUtils.java

/**
 * Gets valid jde home based on the given <code>path</code>. The given <code>path</code> should not contain <b>"bin"</b>.
 *
 * @param path/*ww w  .j a v a  2  s. co m*/
 *            of jde home
 * @return if the give <code>path</code> is a valid jde home, returns the full path of the jde home; otherwise, returns empty
 *         string.
 */
static public String getValidJDEHome(String path) {
    String root = path;
    if (StringUtils.isEmpty(root)) {
        return StringUtils.EMPTY;
    }
    // if "/bin" is already appended, we do not append it again
    if (!path.endsWith(IConstants.BIN_FOLD_NAME))
        root = String.format("%s%s%s", root, File.separator, IConstants.BIN_FOLD_NAME); //$NON-NLS-1$
    if (RIA.validateHomePath(root))
        return root;
    return StringUtils.EMPTY;
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.resourceAllocationManager.ReadExecutionDegreesByExecutionYearId.java

@Atomic
public static List run(String executionYearId) {

    List<InfoExecutionDegree> infoExecutionDegreeList = null;

    ExecutionYear executionYear = null;//ww w  .  j a v a 2s .  com
    if (StringUtils.isEmpty(executionYearId)) {
        executionYear = ExecutionYear.readCurrentExecutionYear();
    } else {
        executionYear = FenixFramework.getDomainObject(executionYearId);
    }

    List<ExecutionDegree> executionDegrees = ExecutionDegree.getAllByExecutionYear(executionYear.getYear());

    if (executionDegrees != null && executionDegrees.size() > 0) {
        Iterator iterator = executionDegrees.iterator();
        infoExecutionDegreeList = new ArrayList<InfoExecutionDegree>();

        while (iterator.hasNext()) {
            ExecutionDegree executionDegree = (ExecutionDegree) iterator.next();
            InfoExecutionDegree infoExecutionDegree = InfoExecutionDegree.newInfoFromDomain(executionDegree);
            infoExecutionDegreeList.add(infoExecutionDegree);
        }
    }

    return infoExecutionDegreeList;
}

From source file:jp.co.nemuzuka.utils.LabelValueBeanUtils.java

/**
 * LabelValueBean??./*from   w  ww  . j  a  v a2  s.  c o m*/
 * ?????1???List????
 * @param targetStr 
 * @param isEmptyData ?????true
 * @return ?List
 */
public static List<LabelValueBean> createList(String targetStr, boolean isEmptyData) {
    List<LabelValueBean> list = new ArrayList<LabelValueBean>();

    if (isEmptyData) {
        list.add(new LabelValueBean("", ""));
    }

    if (StringUtils.isEmpty(targetStr)) {
        return list;
    }

    String[] array = ConvertUtils.toStringArray(targetStr);
    for (String value : array) {
        list.add(new LabelValueBean(value, value));
    }
    return list;
}

From source file:AIR.Common.Web.UrlHelper.java

public static boolean IsFileProtocol(String uriString) {
    if (StringUtils.isEmpty(uriString))
        return false;
    return (uriString.startsWith("file:"));
}

From source file:com.infullmobile.jenkins.plugin.restrictedregister.util.Utils.java

public static String firstNonEmptyString(String... values) {
    for (String value : values) {
        if (!StringUtils.isEmpty(value)) {
            return value;
        }//w  w w. j a v a 2  s  . co  m
    }
    throw new IllegalArgumentException("Provided 0 arguments or all of them are empty");
}

From source file:com.floreantpos.model.CardReader.java

public static CardReader fromString(String name) {
    if (StringUtils.isEmpty(name)) {
        return null;
    }//  w ww .j a  va  2s.  com

    return CardReader.valueOf(name);
}

From source file:net.duckling.ddl.web.bean.NginxAgent.java

/**
 * ??nginxclb?/*  ww  w.  j  a  v  a 2  s.co  m*/
 * @return
 */
public static boolean isNginxMode() {
    VWBContainer c = VWBContainerImpl.findContainer();
    String accessMode = c.getProperty(KeyConstants.CONTAINER_CLB_ACCESS_MODE);
    return !(StringUtils.isEmpty(accessMode) || TOMCAT_FILE_ACCESS_MODE.equals(accessMode));
}