PL-7228 Automatic update crashes with the "No existing modules found." exception if the path to tomcat contains "." or "()".

This commit is contained in:
Andrey Subbotin 2016-05-20 13:04:47 +04:00
parent f2464d0b45
commit f9e4f3aab8

View File

@ -121,7 +121,7 @@ public class ScriptScanner {
try {
String decodedUrl = URLDecoder.decode(resource.getURL().toString(), "UTF-8");
String resourcePath = decodedUrl.replaceFirst(".+?:", "");
Matcher matcher = Pattern.compile(".*" + dbDirPath + "/?(.+?)/.*").matcher(resourcePath);
Matcher matcher = Pattern.compile(".*" + Pattern.quote(dbDirPath) + "/{1}(.+?)/.*").matcher(resourcePath);
return matcher.find() ? matcher.group(1) : null;
} catch (IOException e) {
throw new RuntimeException("An error occurred while detecting modules", e);