Example usage for org.apache.commons.lang Validate notEmpty

List of usage examples for org.apache.commons.lang Validate notEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang Validate notEmpty.

Prototype

public static void notEmpty(String string) 

Source Link

Document

Validate an argument, throwing IllegalArgumentException if the argument String is empty (null or zero length).

 Validate.notEmpty(myString); 

The message in the exception is 'The validated string is empty'.

Usage

From source file:com.vmware.identity.idm.server.RsaAuthSessionCache.java

/**
 * Removes RSA session cache for the given tenant
 * @param tenantName//w  w  w  .jav  a 2 s.  com
 * @throws AuthenticationException
 */
public void removeSessionCache(String tenantName) throws AuthenticationException {
    Validate.notEmpty(tenantName);

    //close all sessions in the session cache
    logger.debug("Removing RSA session cache ... tenant: " + tenantName);

    ConcurrentHashMap<String, AuthenticationSession> sessionCache = _rsaSessionCacheLookup
            .get(tenantName.toLowerCase());

    if (sessionCache == null) {
        logger.debug("No RSA session cache found ... tenant: " + tenantName);
        return;
    } else {
        Iterator<Entry<String, AuthenticationSession>> it = sessionCache.entrySet().iterator();
        while (it.hasNext()) {
            it.next().getValue().closeSession();
        }
    }

    _rsaSessionCacheLookup.remove(tenantName.toLowerCase());
    logger.debug("RSA session cache removed");
}

From source file:ca.uhn.hl7v2.testpanel.util.SegmentAndComponentPath.java

public SegmentAndComponentPath(Segment theSegment, List<Integer> theComponentPath) {
    super();/*  w  w  w .jav  a2s.  co  m*/

    Validate.notNull(theSegment);
    Validate.notNull(theComponentPath);
    Validate.notEmpty(theComponentPath);

    mySegment = theSegment;
    myComponentPath = theComponentPath;
}

From source file:ar.com.zauber.commons.gis.spots.model.GeonameSpot.java

/**
 * @param location the location of the spot
 * @param name the spot name//from   w  w  w  .ja v a 2s.co  m
 * @param ansiName the ansi name
 * @param countryCode country code 
 * @param population population
 */
public GeonameSpot(final Point location, final String name, final String ansiName, final String countryCode,
        final long population) {
    Validate.notNull(location, "location");
    Validate.notNull(name);
    Validate.notNull(ansiName);
    Validate.notEmpty(countryCode);
    Validate.isTrue(population >= 0);

    this.location = location;
    this.name = name;
    this.ansiName = ansiName;
    this.countryCode = countryCode;
    this.population = population;
}

From source file:ar.com.zauber.commons.auth.acegi.password.ldap.LdapUserPasswordPasswordEncoder.java

/** constructor */
public LdapUserPasswordPasswordEncoder(
        final org.springframework.security.authentication.encoding.PasswordEncoder encoder,
        final String algorithm) {
    Validate.notNull(encoder);// w w  w  .java  2  s.  com
    Validate.notEmpty(algorithm);

    this.encoder = encoder;
    this.algorithm = algorithm;
}

From source file:com.condenast.nlp.opennlp.lemmatizer.SimpleLemmatizer.java

private synchronized void loadDictionary(String dictionaryName) {
    Validate.notEmpty(dictionaryName);
    if (cacheDictMap.containsKey(dictionaryName)) {
        dictMap = cacheDictMap.get(dictionaryName);
        return;/*from   w  w w .j  a  v a2  s .  c  o  m*/
    }
    dictMap = new HashMap<>();
    BufferedReader breader = new BufferedReader(new InputStreamReader(dictionaryInputStreamOf(dictionaryName)));
    String line;
    try {
        while ((line = breader.readLine()) != null) {
            String[] elems = line.split("\t");
            dictMap.put(Arrays.asList(elems[0], elems[2]), elems[1]);
        }
    } catch (IOException e) {
        throw new NLPException(e);
    } finally {
        try {
            breader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    cacheDictMap.put(dictionaryName, dictMap);
}

From source file:net.iglyduck.utils.sqlbuilder.ExpressUnit.java

public static Object toExpress(String column, String opt, Object columnValue) {
    Validate.notEmpty(column);
    Validate.notEmpty(opt);/*ww w.  j a v a  2s .co m*/
    Validate.notNull(columnValue);

    if (columnValue instanceof Object[]) {
        Object[] tmp = (Object[]) columnValue;

        ExpressUnit sub = new ExpressUnit();
        for (Object item : tmp) {
            sub.or(column, opt, item);
        }

        return sub; // ExpressUnit
    }

    String value;
    if (columnValue instanceof String) {
        String tmp = ((String) columnValue).trim();
        if (tmp.startsWith("(") && tmp.endsWith(")")) {
            value = tmp;
        } else {
            value = "'" + tmp + "'";
        }
    } else {
        value = columnValue.toString();
    }

    return column + " " + opt + " " + value; // String
}

From source file:com.vmware.identity.saml.SamlAuthorityFactoryPerformanceWrapper.java

@Override
public TokenAuthority createTokenAuthority(String tenantName) throws NoSuchIdPException, SystemException {
    Validate.notEmpty(tenantName);

    return new TokenAuthorityImplPerformanceDecorator(wrapped.createTokenAuthority(tenantName), perfDataSink);
}

From source file:ar.com.zauber.garfio.modules.jira.model.JiraIssue.java

/** @return the {@link RemoteVersion} for an human friendly version
 *  @throws NoSuchEntityException is version does not exists
 *///  w  w w  .j  a  v a 2  s .  c o m
public final RemoteVersion getAvailableVersion(final String version) throws NoSuchEntityException {
    Validate.notEmpty(version);

    RemoteVersion ret = null;
    try {
        final RemoteVersion[] availableActions = session.getJiraSoapService().getVersions(session.getToken(),
                issue.getProject());

        for (final RemoteVersion remoteVersion : availableActions) {
            if (remoteVersion.getName().equalsIgnoreCase(version)) {
                ret = remoteVersion;
                break;
            }
        }
    } catch (final Throwable e) {
        throw new NoSuchEntityException(version, e);
    }

    if (ret == null) {
        throw new NoSuchEntityException(version);
    }

    return ret;
}

From source file:net.iglyduck.utils.sqlbuilder.WrapTable.java

public WrapTable(UnionUnit table, String aliasName) {
    Validate.notNull(table);
    Validate.notEmpty(aliasName);

    this.table = table;
    this.aliasName = aliasName;
}

From source file:ar.com.zauber.commons.message.message.MultipartMessageImpl.java

/** @see MultipartMessage#getPart(java.lang.String) */
public final MessagePart getPart(final String contentType) {
    Validate.notEmpty(contentType);
    for (MessagePart part : parts) {
        if (part.isContentType(contentType)) {
            return part;
        }/*from   ww w .ja va  2  s .  co m*/
    }
    return null;
}