From d1231c63669f4bc3643985b9032de7f998612e08 Mon Sep 17 00:00:00 2001 From: Jason Pyeron <jpyeron@pdinc.us> Date: Sun, 19 Aug 2012 21:35:52 -0400 Subject: [PATCH] fixed build to allow builds where a proxy is needed for access to outside resources see: http://ant.apache.org/manual/proxy.html --- src/com/gitblit/FileSettings.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/com/gitblit/FileSettings.java b/src/com/gitblit/FileSettings.java index 666bda0..be1f44f 100644 --- a/src/com/gitblit/FileSettings.java +++ b/src/com/gitblit/FileSettings.java @@ -87,8 +87,14 @@ 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)) { + // did not replace value because it does not exist in the file + // append new setting to content (issue-85) + content += "\n" + setting.getKey() + " = " + setting.getValue(); + } } FileUtils.writeContent(propertiesFile, content); // manually set the forceReload flag because not all JVMs support real -- Gitblit v1.9.1