FELIX-2105 Multiple OSGi/Minimum-1.1 issues:
  * Replace use of UUID by another mechanism to generate random fall back file name
  * Replace use of Collections.list(Enumeration) by a new method in Util
  * Use Locale.ENGLISH instead of new Locale("")

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@911590 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
index 371ccdd..dec6149 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
@@ -18,8 +18,10 @@
 
 
 import java.io.*;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
+import java.util.Enumeration;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -149,6 +151,25 @@
         Arrays.sort( bundles, BUNDLE_NAME_COMPARATOR );
     }
 
+
+    /**
+     * This method is the same as Collections#list(Enumeration). The reason to
+     * duplicate it here, is that it is missing in OSGi/Minimum execution
+     * environment.
+     *
+     * @param e the enumeration which to convert
+     * @return the list containing all enumeration entries.
+     */
+    public static final ArrayList list( Enumeration e )
+    {
+        ArrayList l = new ArrayList();
+        while ( e.hasMoreElements() )
+        {
+            l.add( e.nextElement() );
+        }
+        return l;
+    }
+
     // ---------- inner classes ------------------------------------------------
 
     private static final Comparator BUNDLE_NAME_COMPARATOR = new Comparator()
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
index e555f69..8aa7400 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
@@ -21,7 +21,6 @@
 
 import java.io.PrintWriter;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Iterator;
 import java.util.TreeMap;
@@ -31,6 +30,7 @@
 import org.apache.felix.scr.Reference;
 import org.apache.felix.scr.ScrService;
 import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;
+import org.apache.felix.webconsole.internal.Util;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentConstants;
@@ -204,7 +204,7 @@
         {
 
             pw.println( "  Properties=" );
-            TreeSet keys = new TreeSet( Collections.list( props.keys() ) );
+            TreeSet keys = new TreeSet( Util.list( props.keys() ) );
             for ( Iterator ki = keys.iterator(); ki.hasNext(); )
             {
                 String key = ( String ) ki.next();
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentsServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentsServlet.java
index ce38ab4..bcc08b9 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentsServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentsServlet.java
@@ -21,7 +21,6 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Iterator;
 import java.util.TreeMap;
@@ -34,15 +33,11 @@
 import org.apache.felix.scr.Component;
 import org.apache.felix.scr.Reference;
 import org.apache.felix.scr.ScrService;
-import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.apache.felix.webconsole.DefaultVariableResolver;
 import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.apache.felix.webconsole.WebConsoleConstants;
 import org.apache.felix.webconsole.WebConsoleUtil;
-import org.apache.felix.webconsole.internal.BaseWebConsolePlugin;
 import org.apache.felix.webconsole.internal.OsgiManagerPlugin;
 import org.apache.felix.webconsole.internal.Util;
-import org.apache.felix.webconsole.internal.core.BundlesServlet;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONWriter;
@@ -87,7 +82,7 @@
     public ComponentsServlet()
     {
         super(LABEL, TITLE, CSS);
-        
+
         // load templates
         TEMPLATE = readTemplateFile( "/templates/components.html" );
     }
@@ -159,14 +154,14 @@
         StringWriter w = new StringWriter();
         PrintWriter w2 = new PrintWriter(w);
         renderResult( w2, reqInfo.component );
-        
+
         // prepare variables
         DefaultVariableResolver vars = ( ( DefaultVariableResolver ) WebConsoleUtil.getVariableResolver( request ) );
         vars.put( "__drawDetails__", reqInfo.componentRequested ? Boolean.TRUE : Boolean.FALSE );
         vars.put( "__data__", w.toString() );
 
         response.getWriter().print( TEMPLATE );
-        
+
     }
 
 
@@ -403,7 +398,7 @@
         if ( props != null )
         {
             JSONArray buf = new JSONArray();
-            TreeSet keys = new TreeSet( Collections.list( props.keys() ) );
+            TreeSet keys = new TreeSet( Util.list( props.keys() ) );
             for ( Iterator ki = keys.iterator(); ki.hasNext(); )
             {
                 final String key = ( String ) ki.next();
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
index 44d89a9..f6721fe 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
@@ -36,7 +36,13 @@
 class ResourceBundleCache
 {
 
-    private static final Locale DEFAULT_LOCALE = new Locale( "" );
+    /**
+     * The default locale corresponding to the default language in the
+     * bundle.properties file, which is english.
+     * (FELIX-1957 The Locale(String) constructor used before is not available
+     * in the OSGi/Minimum-1.1 profile and should be prevented)
+     */
+    private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
 
     private final Bundle bundle;
 
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 eb8ef9a..c6601f4 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
@@ -30,7 +30,6 @@
 
 import org.apache.commons.io.IOUtils;
 import org.apache.felix.webconsole.*;
-import org.apache.felix.webconsole.internal.BaseWebConsolePlugin;
 import org.apache.felix.webconsole.internal.OsgiManagerPlugin;
 import org.apache.felix.webconsole.internal.Util;
 import org.osgi.framework.ServiceReference;
@@ -38,7 +37,7 @@
 
 
 /**
- * ConfigurationRender plugin renders the configuration status - a textual 
+ * ConfigurationRender plugin renders the configuration status - a textual
  * representation of the current framework status. The content itself is
  *  internally generated by the {@link ConfigurationPrinter} plugins.
  */
@@ -300,9 +299,9 @@
      * <pre>
      * label = value
      * </pre>
-     * 
+     *
      * Optionally it can be indented by a specific string.
-     * 
+     *
      * @param pw the writer to print to
      * @param indent indentation string
      * @param label the label data
@@ -732,9 +731,9 @@
                 final String name;
                 if ( path == null || path.length() == 0 )
                 {
-                    // sanity code, we should have a path, but if not let's just create
-                    // some random name
-                    name = UUID.randomUUID().toString();
+                    // sanity code, we should have a path, but if not let's
+                    // just create some random name
+                    name = "file" + Double.doubleToLongBits( Math.random() );
                 }
                 else
                 {