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:com.intel.cosbench.driver.web.MissionPageController.java

@Override
protected ModelAndView process(HttpServletRequest req, HttpServletResponse res) throws Exception {
    String id = req.getParameter("id");
    if (StringUtils.isEmpty(id))
        throw new BadRequestException();
    return process(id);
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.manager.organizationalStructureManagement.MergeExternalUnits.java

@Atomic
public static void run(Unit fromUnit, Unit destinationUnit, Boolean sendMail) {
    check(RolePredicates.MANAGER_PREDICATE);

    if (fromUnit != null && destinationUnit != null) {

        String fromUnitName = fromUnit.getName();
        String fromUnitID = fromUnit.getExternalId();

        Unit.mergeExternalUnits(fromUnit, destinationUnit);

        if (sendMail != null && sendMail.booleanValue()) {

            String emails = FenixConfigurationManager.getConfiguration().getMergeUnitsEmails();
            if (!StringUtils.isEmpty(emails)) {

                Set<String> resultEmails = new HashSet<String>();
                String[] splitedEmails = emails.split(",");
                for (String email : splitedEmails) {
                    resultEmails.add(email.trim());
                }/*from   ww w  . ja  v  a 2s  . c om*/

                // Foi efectuado um merge de unidades externas por {0}[{1}]
                // : Unidade Origem -> {2} [{3}] Unidade Destino -> {4}[{5}]
                final Person person = AccessControl.getPerson();
                final String subject = BundleUtil.getString(Bundle.GLOBAL, "mergeExternalUnits.email.subject");
                final String body = BundleUtil.getString(Bundle.GLOBAL, "mergeExternalUnits.email.body",
                        new String[] { person.getName(), person.getUsername(), fromUnitName, fromUnitID,
                                destinationUnit.getName(), destinationUnit.getExternalId().toString() });

                SystemSender systemSender = Bennu.getInstance().getSystemSender();
                new Message(systemSender, systemSender.getConcreteReplyTos(), Collections.EMPTY_LIST, subject,
                        body, resultEmails);
            }
        }
    }
}

From source file:com.intuit.tank.auth.Security.java

/**
 * //from w w w .  ja  v a  2 s  .com
 * @param entity
 * @return
 */
public boolean isOwner(OwnableEntity entity) {
    return StringUtils.isEmpty(entity.getCreator()) || identity.getUser().getId().equals(entity.getCreator());
}

From source file:com.bstek.dorado.core.el.ExpressionCompiler.java

public List<Object> compileSections(String text) {
    if (StringUtils.isEmpty(text) || text.indexOf(SPECIAL_CHAR) < 0) {
        return null;
    }//from w w  w . j a va 2  s.c  o m

    List<Object> sections = new ArrayList<Object>();
    String middleText = text;
    while (middleText != null) {
        MiddleExpression me = this.middleCompile(middleText);
        if (me == null) {
            sections.add(middleText);
            middleText = null;
        } else {
            sections.add(me.expression);
            middleText = me.nextText;
        }
    }

    return sections;
}

From source file:com.hortonworks.registries.storage.impl.jdbc.provider.oracle.statement.OracleDataTypeContext.java

@Override
public void setPreparedStatementParams(PreparedStatement preparedStatement, Schema.Type type, int index,
        Object val) throws SQLException {
    if (type == Schema.Type.STRING && StringUtils.isEmpty((String) val)) {
        preparedStatement.setString(index, EMPTY_STRING_PLACEHOLDER);
    } else//from ww w.j av  a2 s  .  co m
        super.setPreparedStatementParams(preparedStatement, type, index, val);
}

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

@Override
public void validate(final Object object, final Errors errors) {
    final GuestForm guestForm = (GuestForm) object;
    final String email = guestForm.getEmail();

    if (StringUtils.isEmpty(email)) {
        errors.rejectValue("email", "profile.email.invalid");
    } else if (StringUtils.length(email) > 255 || !EMAIL_REGEX.matcher(email).matches()) {
        errors.rejectValue("email", "profile.email.invalid");
    }/*from  w  w  w  . j  a  v  a  2s .c o  m*/
}

From source file:info.magnolia.cms.util.AlertUtil.java

/**
 * Creates a string message out of an exception. Handles nested exceptions.
 * @param e//from  w ww .j  a v a  2s  . c o  m
 * @return the message
 */
public static String getExceptionMessage(Exception e) {
    String message = e.getMessage();
    if (StringUtils.isEmpty(message)) {
        if (e.getCause() != null) {
            message = e.getCause().getMessage();
        }
        if (message == null) {
            message = StringUtils.EMPTY;
        }
    }
    return message;
}

From source file:net.jforum.util.JDBCLoader.java

/**
 * The sql file to load, relative to the classpath
 * @param sqlfile//from w w  w.j a va2s. c o m
 */
public void run(String sqlfile) {
    BufferedReader reader = null;
    FileReader fileReader = null;

    try {
        fileReader = new FileReader(this.getClass().getResource(sqlfile).getFile());
        reader = new BufferedReader(fileReader);

        String line = null;

        while ((line = reader.readLine()) != null) {
            if (!StringUtils.isEmpty(line)) {
                logger.debug("JDBCLoader: [Running] " + line);
                this.runStatement(line);
            }
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        if (fileReader != null) {
            try {
                fileReader.close();
            } catch (Exception e) {
            }
        }

        if (reader != null) {
            try {
                reader.close();
            } catch (Exception e) {
            }
        }
    }
}

From source file:au.com.permeance.liferay.portlet.documentlibrary.service.DLFolderExportZipServiceUtil.java

public static DLFolderExportZipService getService() {

    if (_service == null) {
        String servletContextName = DownloadFolderZipPropsValues.DL_FOLDER_DOWNLOAD_SERVLET_CONTEXT_NAME;
        if (StringUtils.isEmpty(servletContextName)) {
            throw new IllegalStateException("Servlet context name is undefined");
        }/*from  www  .  j  a v  a2s .c  o m*/
        String beanName = DLFolderExportZipService.class.getName();
        _service = (DLFolderExportZipService) PortletBeanLocatorUtil.locate(servletContextName, beanName);
        ReferenceRegistry.registerReference(DLFolderExportZipServiceUtil.class, SERVICE_FIELD_NAME);
    }

    return _service;
}

From source file:com.bstek.dorado.core.resource.DefaultResourceManager.java

private void checkBundleName() {
    if (StringUtils.isEmpty(bundleName)) {
        throw new IllegalArgumentException("ResourceManager not initilized.");
    }//from  w  ww .j a  v  a 2s.co  m
}