FELIX-1957 apply slightly modified patch by Valentin Valchev (thanks)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@898728 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
index a1b14b8..79cfa25 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
@@ -989,13 +989,30 @@
             String value = String.valueOf(headers.get( header ));
             // Package headers may be long, support line breaking by
             // ensuring blanks after comma and semicolon.
-            value = value.replaceAll( "([;,])", "$1 " );
+            value = enableLineWrapping(value);
             val.put( header + ": " + value );
         }
 
         keyVal( jw, "Manifest Headers", val );
     }
 
+    private static final String enableLineWrapping(final String value)
+    {
+        StringBuffer sb = new StringBuffer(value.length() * 2 / 3);
+        synchronized (sb)
+        { // faster
+            for (int i = 0; i < value.length(); i++)
+            {
+                final char ch = value.charAt( i );
+                sb.append( ch );
+                if ( ch == ';' || ch == ',' )
+                {
+                    sb.append( ' ' );
+                }
+            }
+            return sb.toString();
+        }
+    }
 
     private void listFragmentInfo( final JSONWriter jw, final Bundle bundle, final String pluginRoot )
         throws JSONException