FELIX-1957 Replace use of String.replaceAll not available in OSGi/Minimum-1.0 EE by using a StringTokenizer to replace all occurrences of "<" in strings by "<".
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@900192 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
index b731941..6c8ea60 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
@@ -31,6 +31,7 @@
import java.util.Properties;
import java.util.SortedMap;
import java.util.SortedSet;
+import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.zip.ZipEntry;
@@ -515,7 +516,21 @@
{
if ( string.indexOf( '<' ) >= 0 )
{
- super.write( string.replaceAll( "<", "<" ) );
+ // TODO: replace with WebConsoleUtil.escapeHtml()
+ // this "convoluted" code replaces "<" by "<"
+ final StringTokenizer tokener = new StringTokenizer( string, "<", true );
+ while ( tokener.hasMoreElements() )
+ {
+ final String token = tokener.nextToken();
+ if ( "<".equals( token ) )
+ {
+ super.write( "<" );
+ }
+ else
+ {
+ super.write( token );
+ }
+ }
}
else
{