From 1501a6774ebcb427c50e740f2c4b36f4b8967782 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 28 Oct 2014 09:55:10 -0400
Subject: [PATCH] Merge release 1.6.2
---
src/main/java/com/gitblit/FileSettings.java | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/main/java/com/gitblit/FileSettings.java b/src/main/java/com/gitblit/FileSettings.java
index 2f5f04f..3caf966 100644
--- a/src/main/java/com/gitblit/FileSettings.java
+++ b/src/main/java/com/gitblit/FileSettings.java
@@ -80,6 +80,7 @@
if (propertiesFile != null && propertiesFile.exists() && (forceReload || (propertiesFile.lastModified() > lastModified))) {
FileInputStream is = null;
try {
+ logger.debug("loading {}", propertiesFile);
Properties props = new Properties();
is = new FileInputStream(propertiesFile);
props.load(is);
@@ -124,8 +125,12 @@
if (!StringUtils.isEmpty(include)) {
// allow for multiples
- List<String> names = StringUtils.getStringsFromValue(include, " ");
+ List<String> names = StringUtils.getStringsFromValue(include, ",");
for (String name : names) {
+
+ if (StringUtils.isEmpty(name)) {
+ continue;
+ }
// try co-located
File file = new File(propertiesFile.getParentFile(), name.trim());
@@ -134,16 +139,19 @@
file = new File(name.trim());
}
- if (file.exists()) {
- // load properties
- try (FileInputStream iis = new FileInputStream(file)) {
- baseProperties.load(iis);
- }
-
- // read nested includes
- baseProperties = readIncludes(baseProperties);
-
+ if (!file.exists()) {
+ logger.warn("failed to locate {}", file);
+ continue;
}
+
+ // load properties
+ logger.debug("loading {}", file);
+ try (FileInputStream iis = new FileInputStream(file)) {
+ baseProperties.load(iis);
+ }
+
+ // read nested includes
+ baseProperties = readIncludes(baseProperties);
}
@@ -163,7 +171,7 @@
String content = FileUtils.readContent(propertiesFile, "\n");
for (String key : removals) {
String regex = "(?m)^(" + regExEscape(key) + "\\s*+=\\s*+)"
- + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
+ + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
content = content.replaceAll(regex, "");
}
removals.clear();
@@ -183,7 +191,7 @@
String content = FileUtils.readContent(propertiesFile, "\n");
for (Map.Entry<String, String> setting:settings.entrySet()) {
String regex = "(?m)^(" + regExEscape(setting.getKey()) + "\\s*+=\\s*+)"
- + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
+ + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
String oldContent = content;
content = content.replaceAll(regex, setting.getKey() + " = " + setting.getValue());
if (content.equals(oldContent)) {
--
Gitblit v1.9.1