From d00c43b28a6cac711412231562b74e135255d3de Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 12 Jul 2007 14:41:36 +0000
Subject: [PATCH] This commit addresses issue 1851 "upgrader does not handle new config entries also present in current configuration". This issue is somewhat of a corner case but this code will allow a user to better deal with problems that might arise migrating the configuration or schema of a server.
---
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 5e0ae68..c69dab6 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -1419,9 +1419,18 @@
if (len <= 0)
return d;
if (len > maxll) {
- int p = d.lastIndexOf(' ', maxll);
- if (p <= 0)
- p = d.indexOf(' ', maxll);
+ int p = d.lastIndexOf(Constants.HTML_LINE_BREAK, maxll);
+ if (p > 0 && p < len) {
+ return d.substring(0, p + Constants.HTML_LINE_BREAK.length()) +
+ breakHtmlString(
+ d.substring(p + Constants.HTML_LINE_BREAK.length()),
+ maxll);
+ } else {
+ p = d.lastIndexOf(' ', maxll);
+ if (p <= 0) {
+ p = d.indexOf(' ', maxll);
+ }
+ }
if (p > 0 && p < len) {
return d.substring(0, p) +
Constants.HTML_LINE_BREAK +
@@ -1435,6 +1444,25 @@
}
/**
+ * Strips any potential HTML markup from a given string.
+ * @param s string to strip
+ * @return resulting string
+ */
+ static public String stripHtml(String s) {
+ String o = null;
+ if (s != null) {
+
+ // This is not a comprehensive solution but addresses
+ // the few tags that we have in Resources.properties
+ // at the moment. See test class for cases that might
+ // cause problems.
+ o = s.replaceAll("\\<.*?\\>","");
+
+ }
+ return o;
+ }
+
+ /**
* Tests a text string to see if it contains HTML.
* @param text String to test
* @return true if the string contains HTML
--
Gitblit v1.10.0