From 1027548f7a521cc1c5c0f57d9d1326ed7a5e786b Mon Sep 17 00:00:00 2001 From: John Huss Date: Mon, 7 Jul 2014 09:42:27 -0500 Subject: [PATCH] Fix loading of properties from jar bundles --- .../Sources/er/extensions/appserver/ERXApplication.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java index 5047a37c524..5290f23ea1b 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java @@ -33,6 +33,7 @@ import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import java.util.regex.Pattern; import javax.xml.parsers.DocumentBuilderFactory; @@ -737,12 +738,15 @@ private void collectMainProps(String userName) { URL userPropertiesPath = null; String mainBundleName = NSProperties._mainBundleName(); + // Look for a jar file name like: myapp[-1.0][-SNAPSHOT].jar + Pattern mainBundleJarPattern = Pattern.compile("\\b" + mainBundleName.toLowerCase() + "[-\\.\\d]*(snapshot)?\\.jar"); + while (jarBundles.hasMoreElements()) { URL url = jarBundles.nextElement(); String urlAsString = url.toString(); - if (urlAsString.contains(mainBundleName + ".jar")) { + if (mainBundleJarPattern.matcher(urlAsString.toLowerCase()).find()) { try { propertiesPath = new URL(URLDecoder.decode(urlAsString, CharEncoding.UTF_8)); userPropertiesPath = new URL(propertiesPath.toExternalForm() + userName);