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

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

Introduction

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

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:net.di2e.ecdr.source.rest.TLSUtil.java

public static void setTLSOptions(WebClient client, boolean disableCNCheck) {
    ClientConfiguration clientConfiguration = WebClient.getConfig(client);

    HTTPConduit httpConduit = clientConfiguration.getHttpConduit();

    String keyStorePath = System.getProperty(SSL_KEYSTORE_JAVA_PROPERTY);
    String keyStorePassword = System.getProperty(SSL_KEYSTORE_PASSWORD_JAVA_PROPERTY);
    if (StringUtils.isNotBlank(keyStorePath) && StringUtils.isNotBlank(keyStorePassword)) {
        try {//  www. ja  va 2  s .co  m
            TLSClientParameters tlsParams = new TLSClientParameters();
            LOGGER.debug("Setting disable of CN check on client URL {} to [{}]", client.getCurrentURI(),
                    disableCNCheck);
            tlsParams.setDisableCNCheck(disableCNCheck);

            KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());

            // add the keystore if it exists
            File keystore = new File(keyStorePath);
            if (keystore.exists() && keyStorePassword != null) {
                FileInputStream fis = new FileInputStream(keystore);
                try {
                    LOGGER.debug("Loading keyStore {}", keystore);
                    keyStore.load(fis, keyStorePassword.toCharArray());
                } catch (IOException e) {
                    LOGGER.error("Unable to load keystore. {}", keystore, e);
                } catch (CertificateException e) {
                    LOGGER.error("Unable to load certificates from keystore. {}", keystore, e);
                } finally {
                    IOUtils.closeQuietly(fis);
                }
                KeyManagerFactory keyFactory = KeyManagerFactory
                        .getInstance(KeyManagerFactory.getDefaultAlgorithm());
                keyFactory.init(keyStore, keyStorePassword.toCharArray());
                KeyManager[] km = keyFactory.getKeyManagers();
                tlsParams.setKeyManagers(km);
            }

            httpConduit.setTlsClientParameters(tlsParams);
        } catch (KeyStoreException e) {
            LOGGER.error("Unable to read keystore: ", e);
        } catch (NoSuchAlgorithmException e) {
            LOGGER.error("Problems creating SSL socket. Usually this is "
                    + "referring to the certificate sent by the server not being trusted by the client.", e);
        } catch (FileNotFoundException e) {
            LOGGER.error("Unable to locate one of the SSL stores: {} | {}", keyStorePath, e);
        } catch (UnrecoverableKeyException e) {
            LOGGER.error("Unable to read keystore: ", e);
        }
    }
}

From source file:com.smartitengineering.event.hub.spi.hbase.persistents.EventUUID.java

@Override
public boolean isValid() {
    return StringUtils.isNotBlank(getId()) && eventId != null
            && StringUtils.isNotBlank(eventId.getChannelName());
}

From source file:ips1ap101.lib.base.bundle.BundleWebui.java

public static String defaultIfBlank(String key, String defaultString) {
    if (StringUtils.isNotBlank(key)) {
        try {//from  w w w  .  j ava2s  .  co m
            String string = getTrimmedToNullString(key);
            return StringUtils.defaultIfBlank(string, defaultString);
        } catch (MissingResourceException e) {
        }
    }
    return defaultString;
}

From source file:cn.vlabs.umt.ui.tags.SsoParamsTag.java

public int doEndTag() throws JspException {
    ServletRequest request = pageContext.getRequest();
    JspWriter writer = pageContext.getOut();
    for (String param : Attributes.SSO_PARAMS) {
        String value = request.getParameter(param);
        if (StringUtils.isNotBlank(value)) {
            try {
                writer.println(String.format("<input type=\"hidden\" name=\"%s\" value=\"%s\">", param, value));
            } catch (IOException e) {
                throw new JspException(e);
            }//from  www.ja  v a2 s . co m
        }
    }
    return EVAL_PAGE;
}

From source file:com.bibisco.bean.PointOfView4AnalysisDTO.java

public String getAnalysisChapterPresenceItemDescription() {

    StringBuilder lStringBuilder = new StringBuilder();
    lStringBuilder.append(ResourceBundleManager.getString("com.bibisco.PointOfView." + pointOfView.name()));
    if (StringUtils.isNotBlank(characterName)) {
        lStringBuilder.append(": ");
        lStringBuilder.append(characterName);
    }//from   w w  w  . j  a  v a  2 s. co  m

    return lStringBuilder.toString();
}

From source file:gov.nih.nci.caarray.web.filter.CaarrayStruts2FilterDispatcher.java

/**
 * set the upload temporary directory based on our config.
 * {@inheritDoc}/* www.  ja  v a  2s  .com*/
 */
@Override
protected void postInit(Dispatcher dispatcher, FilterConfig filterConfig) {
    DataConfiguration config = ConfigurationHelper.getConfiguration();
    String multiPartSaveDir = config.getString(ConfigParamEnum.STRUTS_MULTIPART_SAVEDIR.name());
    if (StringUtils.isNotBlank(multiPartSaveDir)) {
        dispatcher.setMultipartSaveDir(multiPartSaveDir);
    }
}

From source file:net.di2e.ecdr.libs.cache.impl.QueryRequestCacheImpl.java

@Override
public boolean isQueryIdUnique(String id) {
    boolean unique = true;
    if (StringUtils.isNotBlank(id)) {
        if (containsKey(id)) {
            unique = false;// w w  w.  j  a v  a2 s  .  c o  m
        } else {
            add(id);
        }
    }
    LOGGER.debug("Checking uniqueness of query with oid=[{}] and returning value for isUnique={}", id, unique);
    return unique;
}

From source file:com.sfs.jbtimporter.JBTIssue.java

/**
 * Instantiates a new jBT issue./*from ww w.  j  av a 2s.c om*/
 *
 * @param jbt the jbt
 */
public JBTIssue(final JBTProcessor jbt) {
    if (StringUtils.isNotBlank(jbt.getExportBase())) {
        this.exportBase = jbt.getExportBase();
    }
}

From source file:com.github.born2snipe.maven.plugin.idea.sandbox.IdeaCacheLocator.java

private File determineDirectory(File ideaRootDirectory, String ideVersion) {
    File directory = determineDefaultDirectory(ideVersion);

    if (ideaRootDirectory != null) {
        String overriddenPath = getOverriddenPath(ideaRootDirectory);
        if (StringUtils.isNotBlank(overriddenPath)) {
            directory = new File(overriddenPath);
        }//from www  .  j  a  v  a  2 s  .com
    }
    return directory;
}

From source file:com.smartitengineering.event.hub.spi.hbase.persistents.ReverseIdIndex.java

@Override
public boolean isValid() {
    return StringUtils.isNotBlank(getId()) && StringUtils.isNotBlank(reverseId);
}