Java Code Examples for org.apache.nifi.util.StringUtils#isNotBlank()
The following examples show how to use
org.apache.nifi.util.StringUtils#isNotBlank() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TlsConfiguration.java From nifi with Apache License 2.0 | 6 votes |
/** * Returns {@code true} if the necessary properties are populated and the keystore can be successfully instantiated (i.e. the path is valid and the password(s) are correct). * * @return true if the keystore properties are valid */ public boolean isKeystoreValid() { boolean simpleCheck = isStoreValid(keystorePath, keystorePassword, keystoreType, "keystore"); if (simpleCheck) { return true; } else if (StringUtils.isNotBlank(keyPassword) && !keystorePassword.equals(keyPassword)) { logger.debug("Simple keystore validity check failed; trying with separate key password"); try { return isKeystorePopulated() && KeyStoreUtils.isKeyPasswordCorrect(new File(keystorePath).toURI().toURL(), keystoreType, keystorePassword.toCharArray(), getFunctionalKeyPassword().toCharArray()); } catch (MalformedURLException e) { logger.error("Encountered an error validating the keystore: " + e.getLocalizedMessage()); return false; } } else { return false; } }
Example 2
Source File: TlsConfiguration.java From nifi with Apache License 2.0 | 6 votes |
private boolean isStorePopulated(String path, String password, KeystoreType type, String label) { boolean isPopulated; String passwordForLogging; // Legacy truststores can be populated without a password; only check the path and type isPopulated = StringUtils.isNotBlank(path) && type != null; if ("truststore".equalsIgnoreCase(label)) { passwordForLogging = getTruststorePasswordForLogging(); } else { // Keystores require a password isPopulated = isPopulated && StringUtils.isNotBlank(password); passwordForLogging = getKeystorePasswordForLogging(); } if (logger.isDebugEnabled()) { logger.debug("TLS config {} is {}: {}, {}, {}", label, isPopulated ? "populated" : "not populated", path, passwordForLogging, type); } return isPopulated; }
Example 3
Source File: SanitizeContextPathFilter.java From nifi with Apache License 2.0 | 5 votes |
@Override public void init(FilterConfig filterConfig) throws ServletException { String providedAllowedList = filterConfig.getServletContext().getInitParameter(ALLOWED_CONTEXT_PATHS_PARAMETER_NAME); logger.debug("SanitizeContextPathFilter received provided allowed context paths from NiFi properties: " + providedAllowedList); if (StringUtils.isNotBlank(providedAllowedList)) { allowedContextPaths = providedAllowedList; } }
Example 4
Source File: TlsConfiguration.java From nifi with Apache License 2.0 | 4 votes |
private static String maskPasswordForLog(String password) { return StringUtils.isNotBlank(password) ? MASKED_PASSWORD_LOG : NULL_LOG; }
Example 5
Source File: TlsConfiguration.java From nifi with Apache License 2.0 | 4 votes |
private boolean isAnyPopulated(String path, String password, KeystoreType type) { return StringUtils.isNotBlank(path) || StringUtils.isNotBlank(password) || type != null; }
Example 6
Source File: TlsConfiguration.java From nifi with Apache License 2.0 | 2 votes |
/** * Returns the "working" key password -- if the key password is populated, it is returned; otherwise the {@link #getKeystorePassword()} is returned. * * @return the key or keystore password actually populated */ public String getFunctionalKeyPassword() { return StringUtils.isNotBlank(keyPassword) ? keyPassword : keystorePassword; }