< prev index next >
src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java
Print this page
@@ -393,11 +393,13 @@
* @param disjunct non-null mask disjunct
* @return java regex string corresponding to this mask
*/
static String disjunctToRegex(String disjunct) {
String regex;
- if (disjunct.startsWith("*")) {
+ if (disjunct.startsWith("*") && disjunct.endsWith("*")) {
+ regex = ".*" + quote(disjunct.substring(1, disjunct.length() - 1)) + ".*";
+ } else if (disjunct.startsWith("*")) {
regex = ".*" + quote(disjunct.substring(1));
} else if (disjunct.endsWith("*")) {
regex = quote(disjunct.substring(0, disjunct.length() - 1)) + ".*";
} else {
regex = quote(disjunct);
< prev index next >