use of java.util.regex.Matcher in project jetty.project by eclipse.
the class SslContextFactory method removeExcludedCipherSuites.
protected void removeExcludedCipherSuites(List<String> selected_ciphers) {
for (String excludeCipherSuite : _excludeCipherSuites) {
Pattern excludeCipherPattern = Pattern.compile(excludeCipherSuite);
for (Iterator<String> i = selected_ciphers.iterator(); i.hasNext(); ) {
String selectedCipherSuite = i.next();
Matcher m = excludeCipherPattern.matcher(selectedCipherSuite);
if (m.matches())
i.remove();
}
}
}
use of java.util.regex.Matcher in project jetty.project by eclipse.
the class SslContextFactory method processIncludeCipherSuites.
protected void processIncludeCipherSuites(String[] supportedCipherSuites, List<String> selected_ciphers) {
for (String cipherSuite : _includeCipherSuites) {
Pattern p = Pattern.compile(cipherSuite);
boolean added = false;
for (String supportedCipherSuite : supportedCipherSuites) {
Matcher m = p.matcher(supportedCipherSuite);
if (m.matches()) {
added = true;
selected_ciphers.add(supportedCipherSuite);
}
}
if (!added)
LOG.info("No Cipher matching '{}' is supported", cipherSuite);
}
}
use of java.util.regex.Matcher in project che by eclipse.
the class DockerfileParserTest method testConditionPatternEmptyCondition2.
@Test
public void testConditionPatternEmptyCondition2() {
String conditionTemplate = "aaa>=?bbb:ccc";
Matcher m = Dockerfile.TEMPLATE_CONDITIONAL_PATTERN.matcher(conditionTemplate);
assertTrue(m.matches());
assertEquals(m.groupCount(), 5);
assertEquals(m.group(1), "aaa");
assertEquals(m.group(2), ">=");
assertEquals(m.group(3), "");
assertEquals(m.group(4), "bbb");
assertEquals(m.group(5), "ccc");
}
use of java.util.regex.Matcher in project che by eclipse.
the class DockerfileParserTest method testConditionPatternEmptyConditionAndNoExpression2.
@Test
public void testConditionPatternEmptyConditionAndNoExpression2() {
String conditionTemplate = "aaa=?bbb:";
Matcher m = Dockerfile.TEMPLATE_CONDITIONAL_PATTERN.matcher(conditionTemplate);
assertTrue(m.matches());
assertEquals(m.groupCount(), 5);
assertEquals(m.group(1), "aaa");
assertEquals(m.group(2), "=");
assertEquals(m.group(3), "");
assertEquals(m.group(4), "bbb");
assertEquals(m.group(5), "");
}
use of java.util.regex.Matcher in project hbase by apache.
the class HTableDescriptor method addCoprocessorToMap.
/**
* Add coprocessor to values Map
* @param specStr The Coprocessor specification all in in one String formatted so matches
* {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}
* @return Returns <code>this</code>
*/
private HTableDescriptor addCoprocessorToMap(final String specStr) {
if (specStr == null)
return this;
// generate a coprocessor key
int maxCoprocessorNumber = 0;
Matcher keyMatcher;
for (Map.Entry<Bytes, Bytes> e : this.values.entrySet()) {
keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get()));
if (!keyMatcher.matches()) {
continue;
}
maxCoprocessorNumber = Math.max(Integer.parseInt(keyMatcher.group(1)), maxCoprocessorNumber);
}
maxCoprocessorNumber++;
String key = "coprocessor$" + Integer.toString(maxCoprocessorNumber);
this.values.put(new Bytes(Bytes.toBytes(key)), new Bytes(Bytes.toBytes(specStr)));
return this;
}
Aggregations