List of usage examples for org.apache.commons.lang3 StringUtils containsAny
public static boolean containsAny(CharSequence cs, CharSequence... searchCharSequences)
Checks if the CharSequence contains any of the CharSequences in the given array.
A null CharSequence will return false .
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlLoaderTest.java
private void assertFailureDuringLoad(String configXML, Class<?> expectedExceptionClass, String... expectedMessage) { try {/*from w ww .j a v a2 s .c om*/ xmlLoader.loadConfigHolder(configXML); fail("Should have failed with an exception of type: " + expectedExceptionClass.getSimpleName()); } catch (Exception e) { String message = "\nExpected: " + expectedExceptionClass.getSimpleName() + "\nActual : " + e.getClass().getSimpleName() + " with message: " + e.getMessage(); assertThat(e.getClass().equals(expectedExceptionClass)).as(message).isTrue(); assertThat(StringUtils.containsAny(e.getMessage(), expectedMessage)).isTrue(); } }
From source file:org.cryptomator.frontend.webdav.servlet.UnicodeResourcePathNormalizationFilter.java
private boolean isUserAgentExpectingNfdResponses(HttpServletRequest request) { String userAgent = request.getHeader(USER_AGENT_HEADER); return StringUtils.containsAny(userAgent, USER_AGENTS_EXPECTING_NFD); }
From source file:org.eclipse.ebr.maven.eclipseip.KnownLicenses.java
/** * Determines if the specified license is a known dual license. * * @param license/*from ww w . j av a 2 s . c o m*/ * @return <code>true</code> if it's a dual license, <code>false</code> * otherwise */ public boolean isDualLicense(final License license) { final String upperCaseLicenseName = StringUtils.upperCase(license.getName()); return StringUtils.containsAny(upperCaseLicenseName, "GPL") && StringUtils.containsAny(upperCaseLicenseName, "CDDL"); }
From source file:org.kalypso.commons.databinding.validation.StringFilenameValidator.java
@Override protected IStatus doValidate(final String value) throws CoreException { if (StringUtils.containsAny(value, INVALID)) fail();//from ww w .j av a 2 s . c o m return ValidationStatus.ok(); }
From source file:org.lockss.rewriter.RegexpCssLinkRewriterFactory.java
/** Backslash escape special characters in URL */ String urlEscape(String url) { if (!StringUtils.containsAny(url, CSS_ESCAPE_CHARS)) { return url; }/*from w ww . ja v a2 s . c o m*/ StringBuilder sb = new StringBuilder(); int len = url.length(); for (int counter = 0; counter < len; counter++) { char c = url.charAt(counter); if (CSS_ESCAPE_CHARS.indexOf(c) >= 0) { sb.append("\\"); } sb.append(c); } return sb.toString(); }
From source file:org.pentaho.platform.web.http.api.resources.services.UserRoleDaoService.java
private boolean containsReservedChars(String username) { StringBuffer reservedChars = new FileService().doGetReservedChars(); return StringUtils.containsAny(username, reservedChars); }
From source file:org.wrml.runtime.rest.Resource.java
/** * Adds a resource to this resource's list of subresources, differentiating based on its inclusion of the { * character whether it's a literal or variable subresource * * @param subresource/*from w w w .ja v a 2 s. c om*/ */ void addSubresource(final Resource subresource) { final String pathSegment = subresource.getPathSegment(); if (StringUtils.containsAny(pathSegment, '{')) { addVariablePathSubresource(pathSegment, subresource); } else { addLiteralPathSubresource(pathSegment, subresource); } }
From source file:org.xlcloud.console.applications.autocomplete.AutocompleteMatcher.java
/** {@inheritDoc} */ @Override//from w w w . j a v a 2s. co m protected boolean matchesSafely(String item) { return StringUtils.containsAny(item, query) || StringUtils.containsIgnoreCase(item, query); }
From source file:piuk.MyWallet.java
public boolean addTxNote(Hash hash, String note) throws Exception { //Disallow quotes and < > if (StringUtils.containsAny(note, "\"'<>")) { throw new Exception("Note contains invalid characters"); }/*from w w w . jav a2 s . com*/ getTxNotes().put(hash.toString(), note); return true; }
From source file:rapture.structured.DefaultValidator.java
/** * Do not allow the '.' character in columns or tables, which is standard sql * /* w w w. j a v a 2s . c o m*/ * @param s * @return */ private boolean isValid(String s) { return !StringUtils.isBlank(s) && !StringUtils.containsAny(s, "."); }