FELIX-3283 Use generics
  - add animal sniffer plugin to ensure not using non-Java 1.4 API
  - Add generics everywhere
  - convert traditional collection loops to foreach loops
  - Update exported package version to 3.1.4 because of changed code

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1215540 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/pom.xml b/webconsole/pom.xml
index 2c51ed9..45708fa 100644
--- a/webconsole/pom.xml
+++ b/webconsole/pom.xml
@@ -81,6 +81,7 @@
                     </execution>
                 </executions>
             </plugin>
+            <!-- Allow certain Java 5 features, generate Java 1.4 class files -->
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
@@ -88,6 +89,27 @@
                     <target>jsr14</target>
                 </configuration>
             </plugin>
+            <!-- Make sure to not use non Java 1.4 API -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>animal-sniffer-maven-plugin</artifactId>
+                <version>1.7</version>
+                <configuration>
+                    <signature>
+                        <groupId>org.codehaus.mojo.signature</groupId>
+                        <artifactId>java14</artifactId>
+                        <version>1.0</version>
+                    </signature>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
index 2e998dd..eb4868d 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
@@ -22,6 +22,7 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.*;
+import java.util.Map.Entry;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.*;
@@ -172,7 +173,7 @@
      * @param request the original request passed from the HTTP server
      * @return <code>true</code> if the page should have headers and footers rendered
      */
-    protected boolean isHtmlRequest( final HttpServletRequest request )
+    protected boolean isHtmlRequest( @SuppressWarnings("unused") final HttpServletRequest request )
     {
         return true;
     }
@@ -335,7 +336,7 @@
         {
             try
             {
-                Class cl = resourceProvider.getClass();
+                Class<?> cl = resourceProvider.getClass();
                 while ( tmpGetResourceMethod == null && cl != Object.class )
                 {
                     Method[] methods = cl.getDeclaredMethods();
@@ -590,15 +591,14 @@
 
         boolean disabled = false;
         String appRoot = ( String ) request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT );
-        Map labelMap = ( Map ) request.getAttribute( WebConsoleConstants.ATTR_LABEL_MAP );
+        @SuppressWarnings("unchecked")
+        Map<String, String> labelMap = ( Map<String, String> ) request.getAttribute( WebConsoleConstants.ATTR_LABEL_MAP );
         if ( labelMap != null )
         {
 
             // prepare the navigation
-            SortedMap map = new TreeMap( String.CASE_INSENSITIVE_ORDER );
-            for ( Iterator ri = labelMap.entrySet().iterator(); ri.hasNext(); )
-            {
-                Map.Entry labelMapEntry = ( Map.Entry ) ri.next();
+            SortedMap<String, String> map = new TreeMap<String, String>( String.CASE_INSENSITIVE_ORDER );
+            for (Entry<String, String> labelMapEntry : labelMap.entrySet()) {
                 if ( labelMapEntry.getKey() == null )
                 {
                     // ignore renders without a label
@@ -625,7 +625,7 @@
 
             // render the navigation
             pw.println("<div id='technav' class='ui-widget ui-widget-header'>"); //$NON-NLS-1$
-            for ( Iterator li = map.values().iterator(); li.hasNext(); )
+            for ( Iterator<String> li = map.values().iterator(); li.hasNext(); )
             {
                 pw.print(' ');
                 pw.println( li.next() );
@@ -635,7 +635,8 @@
         }
 
         // render lang-box
-        Map langMap = (Map) request.getAttribute(WebConsoleConstants.ATTR_LANG_MAP);
+        @SuppressWarnings("unchecked")
+        Map<String, String> langMap = (Map<String, String>) request.getAttribute(WebConsoleConstants.ATTR_LANG_MAP);
         if (null != langMap && !langMap.isEmpty())
         {
             // determine the currently selected locale from the request and fail-back
@@ -658,7 +659,7 @@
             printLocaleElement(pw, appRoot, locale, langMap.get(locale));
             pw.println(" </span>"); //$NON-NLS-1$
             pw.println(" <span class='flags ui-helper-hidden'>"); //$NON-NLS-1$
-            for (Iterator li = langMap.keySet().iterator(); li.hasNext();)
+            for (Iterator<String> li = langMap.keySet().iterator(); li.hasNext();)
             {
                 // <img src="us.gif" alt="en" title="English"/>
                 final Object l = li.next();
@@ -838,7 +839,7 @@
         return readTemplateFile( getClass(), templateFile );
     }
 
-    private final String readTemplateFile( final Class clazz, final String templateFile)
+    private final String readTemplateFile( final Class<?> clazz, final String templateFile)
     {
         InputStream templateStream = clazz.getResourceAsStream( templateFile );
         if ( templateStream != null )
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
index baf7f67..3e95e5f 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
@@ -31,7 +31,7 @@
  * {@link WebConsoleUtil#getVariableResolver(javax.servlet.ServletRequest)}
  * as the variable resolver if none has yet been assigned to the request.
  */
-public class DefaultVariableResolver extends HashMap implements VariableResolver
+public class DefaultVariableResolver extends HashMap<String, String> implements VariableResolver
 {
 
     private static final long serialVersionUID = 4148807223433047780L;
@@ -48,7 +48,7 @@
 
     /**
      * Creates a new variable resolver and initializes both - capacity & load factor
-     * 
+     *
      * @param initialCapacity  the initial capacity of the variable container
      * @param loadFactor the load factor of the variable container
      * @see HashMap#HashMap(int, float)
@@ -61,7 +61,7 @@
 
     /**
      * Creates a new variable resolver with specified initial capacity
-     * 
+     *
      * @param initialCapacity  the initial capacity of the variable container
      * @see HashMap#HashMap(int)
      */
@@ -73,11 +73,11 @@
 
     /**
      * Creates a new variable resolver copying the variables from the given map.
-     * 
+     *
      * @param source  the map whose variables are to be placed in this resolver.
      * @see HashMap#HashMap(Map)
      */
-    public DefaultVariableResolver( final Map source )
+    public DefaultVariableResolver( final Map<String, String> source )
     {
         super( source );
     }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
index 8bb3a60..1d61bd9 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
@@ -22,7 +22,6 @@
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.osgi.framework.BundleContext;
@@ -57,7 +56,7 @@
     private ServiceRegistration reg;
 
     // used to obtain services. Structure is: service name -> ServiceTracker
-    private final Map services = new HashMap();
+    private final Map<String, ServiceTracker> services = new HashMap<String, ServiceTracker>();
 
 
     /**
@@ -151,7 +150,7 @@
         {
             activate( bc ); // don't know why this is needed!
 
-            Hashtable props = new Hashtable();
+            Hashtable<String, String> props = new Hashtable<String, String>();
             props.put( WebConsoleConstants.PLUGIN_LABEL, label );
             props.put( WebConsoleConstants.PLUGIN_TITLE, title );
             reg = bc.registerService( "javax.servlet.Servlet", this, props ); //$NON-NLS-1$
@@ -190,7 +189,7 @@
      */
     public final Object getService( String serviceName )
     {
-        ServiceTracker serviceTracker = ( ServiceTracker ) services.get( serviceName );
+        ServiceTracker serviceTracker = services.get( serviceName );
         if ( serviceTracker == null )
         {
             serviceTracker = new ServiceTracker( getBundleContext(), serviceName, null );
@@ -212,12 +211,11 @@
      */
     public void deactivate()
     {
-        for ( Iterator ti = services.values().iterator(); ti.hasNext(); )
+        for ( ServiceTracker tracker : services.values() )
         {
-            ServiceTracker tracker = ( ServiceTracker ) ti.next();
             tracker.close();
-            ti.remove();
         }
+        services.clear();
         super.deactivate();
     }
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
index 6fb96d1..d97678d 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
@@ -23,7 +23,6 @@
 import java.lang.reflect.Array;
 import java.net.URLDecoder;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -84,8 +83,8 @@
 
         final DefaultVariableResolver resolver = new DefaultVariableResolver();
         // FIXME: don't we need a constant for the values below?
-        resolver.put( "appRoot", request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT ) ); //$NON-NLS-1$
-        resolver.put( "pluginRoot", request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT ) ); //$NON-NLS-1$
+        resolver.put( "appRoot", (String) request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT ) ); //$NON-NLS-1$
+        resolver.put( "pluginRoot", (String) request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT ) ); //$NON-NLS-1$
         setVariableResolver( request, resolver );
         return resolver;
     }
@@ -131,7 +130,8 @@
         }
 
         // check, whether we already have the parameters
-        Map params = ( Map ) request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
+        @SuppressWarnings("unchecked")
+        Map<String, FileItem[]> params = ( Map<String, FileItem[]> ) request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
         if ( params == null )
         {
             // parameters not read yet, read now
@@ -144,14 +144,13 @@
             upload.setSizeMax( -1 );
 
             // Parse the request
-            params = new HashMap();
+            params = new HashMap<String, FileItem[]>();
             try
             {
-                List items = upload.parseRequest( request );
-                for ( Iterator fiter = items.iterator(); fiter.hasNext(); )
-                {
-                    FileItem fi = ( FileItem ) fiter.next();
-                    FileItem[] current = ( FileItem[] ) params.get( fi.getFieldName() );
+                @SuppressWarnings("unchecked")
+                List<FileItem> items = upload.parseRequest( request );
+                for (final FileItem fi : items) {
+                    FileItem[] current = params.get( fi.getFieldName() );
                     if ( current == null )
                     {
                         current = new FileItem[]
@@ -174,7 +173,7 @@
             request.setAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD, params );
         }
 
-        FileItem[] param = ( FileItem[] ) params.get( name );
+        FileItem[] param = params.get( name );
         if ( param != null )
         {
             for ( int i = 0; i < param.length; i++ )
@@ -350,6 +349,7 @@
      * @param value the value to decode
      * @return the decoded string
      */
+    @SuppressWarnings("deprecation")
     public static String urlDecode( final String value )
     {
         // shortcut for empty or missing values
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 c90cb63..f897d55 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
@@ -133,21 +133,21 @@
      * @param e the enumeration which to convert
      * @return the list containing all enumeration entries.
      */
-    public static final ArrayList list( Enumeration e )
+    public static final <T> ArrayList<T> list( Enumeration<T> e )
     {
-        ArrayList l = new ArrayList();
+        ArrayList<T> l = new ArrayList<T>();
         while ( e.hasMoreElements() )
         {
             l.add( e.nextElement() );
         }
         return l;
     }
-    
+
     /**
      * This method expects a locale string in format language_COUNTRY, or
      * language. The method will determine which is the correct form of locale
      * string and construct a <code>Locale</code> object.
-     * 
+     *
      * @param locale the locale string, if <code>null</code> - default locale is
      *          returned
      * @return a locale object
@@ -180,7 +180,7 @@
         return new Locale(language, country);
     }
 
-    private static final class BundleNameComparator implements Comparator
+    private static final class BundleNameComparator implements Comparator<Bundle>
     {
         private final Locale locale;
 
@@ -191,12 +191,6 @@
         }
 
 
-        public int compare( Object o1, Object o2 )
-        {
-            return compare( ( Bundle ) o1, ( Bundle ) o2 );
-        }
-
-
         public int compare( Bundle b1, Bundle b2 )
         {
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
index 2d1c57c..06ba761 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
@@ -248,14 +248,14 @@
         }
         else if ( value != null )
         {
-            final Collection cssListColl;
+            final Collection<?> cssListColl;
             if ( value.getClass().isArray() )
             {
                 cssListColl = Arrays.asList( ( Object[] ) value );
             }
             else if ( value instanceof Collection )
             {
-                cssListColl = ( Collection ) value;
+                cssListColl = ( Collection<?> ) value;
             }
             else
             {
@@ -266,7 +266,7 @@
             {
                 String[] entries = new String[cssListColl.size()];
                 int i = 0;
-                for ( Iterator cli = cssListColl.iterator(); cli.hasNext(); i++ )
+                for ( Iterator<?> cli = cssListColl.iterator(); cli.hasNext(); i++ )
                 {
                     entries[i] = String.valueOf( cli.next() );
                 }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
index 8d79780..e887583 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
@@ -40,6 +40,7 @@
 /**
  * The <code>ConfigManager</code> TODO
  */
+@SuppressWarnings("serial")
 public class ConfigManager extends ConfigManagerBase
 {
     private static final String LABEL = "configMgr"; // was name
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
index 99cbf8e..d6aaac1 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
@@ -75,7 +75,7 @@
      * @param locale The name of the locale to get the meta data for.
      * @return see the method description
      */
-    protected Map getPidObjectClasses( final String locale )
+    protected Map<String, ObjectClassDefinition> getPidObjectClasses( final String locale )
     {
         return getObjectClassDefinitions( PID_GETTER, locale );
     }
@@ -90,7 +90,7 @@
      * @param locale The name of the locale to get the meta data for.
      * @return see the method description
      */
-    protected Map getFactoryPidObjectClasses( final String locale )
+    protected Map<String, ObjectClassDefinition> getFactoryPidObjectClasses( final String locale )
     {
         return getObjectClassDefinitions( FACTORY_PID_GETTER, locale );
     }
@@ -109,9 +109,9 @@
      * @return Map of <code>ObjectClassDefinition</code> objects indexed by the
      *      PID (or factory PID) to which they pertain
      */
-    private Map getObjectClassDefinitions( final IdGetter idGetter, final String locale )
+    private Map<String, ObjectClassDefinition> getObjectClassDefinitions( final IdGetter idGetter, final String locale )
     {
-        final Map objectClassesDefinitions = new HashMap();
+        final Map<String, ObjectClassDefinition> objectClassesDefinitions = new HashMap<String, ObjectClassDefinition>();
         final MetaTypeService mts = this.getMetaTypeService();
         if ( mts != null )
         {
@@ -242,9 +242,9 @@
     }
 
 
-    protected Map getAttributeDefinitionMap( Configuration config, String locale )
+    protected Map<String, AttributeDefinition> getAttributeDefinitionMap( Configuration config, String locale )
     {
-        Map adMap = new HashMap();
+        Map<String, AttributeDefinition> adMap = new HashMap<String, AttributeDefinition>();
         ObjectClassDefinition ocd = this.getObjectClassDefinition( config, locale );
         if ( ocd != null )
         {
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
index 05acf2e..d14eabe 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
@@ -71,15 +71,15 @@
                 Configuration[] configs = ca.listConfigurations( null );
                 if ( configs != null && configs.length > 0 )
                 {
-                    SortedMap sm = new TreeMap();
+                    SortedMap<String, Configuration> sm = new TreeMap<String, Configuration>();
                     for ( int i = 0; i < configs.length; i++ )
                     {
                         sm.put( configs[i].getPid(), configs[i] );
                     }
 
-                    for ( Iterator mi = sm.values().iterator(); mi.hasNext(); )
+                    for ( Iterator<Configuration> mi = sm.values().iterator(); mi.hasNext(); )
                     {
-                        this.printConfiguration( pw, ( Configuration ) mi.next() );
+                        this.printConfiguration( pw, mi.next() );
                     }
                 }
                 else
@@ -111,18 +111,18 @@
         String loc = ( config.getBundleLocation() != null ) ? config.getBundleLocation() : "Unbound";
         ConfigurationRender.infoLine( pw, "  ", "BundleLocation", loc );
 
-        Dictionary props = config.getProperties();
+        @SuppressWarnings("unchecked")
+        Dictionary<String, ?> props = config.getProperties();
         if ( props != null )
         {
-            SortedSet keys = new TreeSet();
-            for ( Enumeration ke = props.keys(); ke.hasMoreElements(); )
+            SortedSet<String> keys = new TreeSet<String>();
+            for ( Enumeration<String> ke = props.keys(); ke.hasMoreElements(); )
             {
                 keys.add( ke.nextElement() );
             }
 
-            for ( Iterator ki = keys.iterator(); ki.hasNext(); )
+            for ( String key : keys )
             {
-                String key = ( String ) ki.next();
                 ConfigurationRender.infoLine( pw, "  ", key, props.get( key ) );
             }
         }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
index c57a2c8..06dc5ff 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
@@ -39,6 +39,7 @@
 /**
  * LogServlet provides support for reading the log messages.
  */
+@SuppressWarnings("serial")
 public class LogServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin
 {
     private static final String LABEL = "logs";
@@ -63,7 +64,7 @@
     /**
      * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
-    protected void doPost( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException
+    protected void doPost( HttpServletRequest req, HttpServletResponse resp ) throws IOException
     {
         final int minLevel = WebConsoleUtil.getParameterInt( req, "minLevel", LogService.LOG_DEBUG );
 
@@ -94,7 +95,7 @@
             if ( logReaderService != null )
             {
                 int index = 0;
-                for ( Enumeration logEntries = logReaderService.getLog(); logEntries.hasMoreElements()
+                for ( Enumeration<?> logEntries = logReaderService.getLog(); logEntries.hasMoreElements()
                     && index < MAX_LOGS; )
                 {
                     LogEntry nextLog = ( LogEntry ) logEntries.nextElement();
@@ -142,8 +143,7 @@
     /**
      * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
-    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
-        IOException
+    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         response.getWriter().print(TEMPLATE);
     }
@@ -173,9 +173,10 @@
     private static final String serviceDescription( ServiceReference serviceReference )
     {
         if ( serviceReference == null )
+        {
             return "";
-        else
-            return serviceReference.toString();
+        }
+        return serviceReference.toString();
     }
 
 
@@ -199,9 +200,10 @@
     private static final String exceptionMessage( Throwable e )
     {
         if ( e == null )
+        {
             return "";
-        else
-            return e.getClass().getName()+": "+e.getMessage();
+        }
+        return e.getClass().getName() + ": " + e.getMessage();
     }
 
 }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
index acf26d5..8a5fd2b 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
@@ -170,7 +170,7 @@
             }

         }

 

-        Class[] flavors = wire.getFlavors();

+        Class<?>[] flavors = wire.getFlavors();

         if (flavors == null)

         {

             pw.println("  Flavors: none");

@@ -187,7 +187,7 @@
             pw.println();

         }

 

-        Dictionary props = wire.getProperties();

+        Dictionary<?, ?> props = wire.getProperties();

         if (props == null)

         {

             pw.println("  Properties: none");

@@ -195,7 +195,7 @@
         else

         {

             pw.println("  Properties: ");

-            for (Enumeration e = props.keys(); e.hasMoreElements();)

+            for (Enumeration<?> e = props.keys(); e.hasMoreElements();)

             {

                 final Object key = e.nextElement();

                 pw.print("    "); //$NON-NLS-1$

diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
index d1abb70..2c5f135 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
@@ -20,7 +20,6 @@
 import java.io.PrintWriter;
 import java.text.MessageFormat;
 import java.util.*;
-
 import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;
 import org.osgi.framework.*;
 import org.osgi.service.packageadmin.PackageAdmin;
@@ -103,7 +102,7 @@
     {
         final Bundle[] bundles = this.getBundleContext().getBundles();
         // create a map for sorting first
-        final TreeMap bundlesMap = new TreeMap();
+        final TreeMap<String, String> bundlesMap = new TreeMap<String, String>();
         int active = 0, installed = 0, resolved = 0, fragments = 0;
         for( int i =0; i<bundles.length; i++)
         {
@@ -176,12 +175,9 @@
         }
         pw.println(buffer.toString());
         pw.println("-----------------------------------------------------------------------------");
-        final Iterator i = bundlesMap.entrySet().iterator();
-        while ( i.hasNext() )
+        for ( final String bundle : bundlesMap.values() )
         {
-            final Map.Entry entry = (Map.Entry)i.next();
-            pw.println(entry.getValue());
-
+            pw.println( bundle );
         }
     }
 
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 8ac69d0..a13698d 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
@@ -49,6 +49,7 @@
  * the list of bundles, installed on the framework. It also adds ability to control
  * the lifecycle of the bundles, like start, stop, uninstall, install.
  */
+@SuppressWarnings("serial")
 public class BundlesServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin, ConfigurationPrinter
 {
 
@@ -118,7 +119,7 @@
             bootPkgs[i] = bootDelegation;
         }
 
-        Hashtable props = new Hashtable();
+        Hashtable<String, Object> props = new Hashtable<String, Object>();
         props.put( WebConsoleConstants.CONFIG_PRINTER_MODES, new String[] { ConfigurationPrinter.MODE_TXT,
             ConfigurationPrinter.MODE_ZIP } );
         configurationPrinter = bundleContext.registerService( ConfigurationPrinter.SERVICE, this, props );
@@ -455,7 +456,7 @@
     /**
      * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
-    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException
+    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         // get request info from request attribute
         final RequestInfo reqInfo = getRequestInfo(request);
@@ -465,7 +466,7 @@
         // prepare variables
         DefaultVariableResolver vars = ( ( DefaultVariableResolver ) WebConsoleUtil.getVariableResolver( request ) );
         vars.put( "startLevel", String.valueOf(startLevel));
-        vars.put( "drawDetails", reqInfo.bundleRequested ? Boolean.TRUE : Boolean.FALSE );
+        vars.put( "drawDetails", String.valueOf(reqInfo.bundleRequested));
         vars.put( "currentBundle", (reqInfo.bundleRequested && reqInfo.bundle != null ? String.valueOf(reqInfo.bundle.getBundleId()) : "null"));
 
         final String pluginRoot = ( String ) request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT );
@@ -518,7 +519,7 @@
         else if (filter != null)
         {
             Filter f = getBundleContext().createFilter(filter);
-            ArrayList list = new ArrayList(allBundles.length);
+            ArrayList<Bundle> list = new ArrayList<Bundle>(allBundles.length);
             final String localeString = locale.toString();
             for (int i = 0, size = allBundles.length; i < size; i++)
             {
@@ -718,7 +719,8 @@
     private final void bundleDetails( JSONWriter jw, Bundle bundle, final String pluginRoot, final String servicesRoot, final Locale locale)
         throws JSONException
     {
-        Dictionary headers = bundle.getHeaders( locale == null ? null : locale.toString() );
+        @SuppressWarnings("unchecked")
+        Dictionary<String, String> headers = bundle.getHeaders( locale == null ? null : locale.toString() );
 
         jw.key( "props" );
         jw.array();
@@ -727,7 +729,7 @@
         WebConsoleUtil.keyVal( jw, "Bundle Location", bundle.getLocation() );
         WebConsoleUtil.keyVal( jw, "Last Modification", new Date( bundle.getLastModified() ) );
 
-        String docUrl = ( String ) headers.get( Constants.BUNDLE_DOCURL );
+        String docUrl = headers.get( Constants.BUNDLE_DOCURL );
         if ( docUrl != null )
         {
             WebConsoleUtil.keyVal( jw, "Bundle Documentation", docUrl );
@@ -787,24 +789,18 @@
             return;
         }
 
-        Map usingBundles = new TreeMap();
+        Map<String, Bundle> usingBundles = new TreeMap<String, Bundle>();
 
         ExportedPackage[] exports = packageAdmin.getExportedPackages( bundle );
         if ( exports != null && exports.length > 0 )
         {
             // do alphabetical sort
-            Arrays.sort( exports, new Comparator()
+            Arrays.sort( exports, new Comparator<ExportedPackage>()
             {
                 public int compare( ExportedPackage p1, ExportedPackage p2 )
                 {
                     return p1.getName().compareTo( p2.getName() );
                 }
-
-
-                public int compare( Object o1, Object o2 )
-                {
-                    return compare( ( ExportedPackage ) o1, ( ExportedPackage ) o2 );
-                }
             } );
 
             JSONArray val = new JSONArray();
@@ -835,7 +831,7 @@
         if ( exports != null && exports.length > 0 )
         {
             // collect import packages first
-            final List imports = new ArrayList();
+            final List<ExportedPackage> imports = new ArrayList<ExportedPackage>();
             for ( int i = 0; i < exports.length; i++ )
             {
                 final ExportedPackage ep = exports[i];
@@ -854,20 +850,14 @@
             JSONArray val = new JSONArray();
             if ( imports.size() > 0 )
             {
-                final ExportedPackage[] packages = ( ExportedPackage[] ) imports.toArray( new ExportedPackage[imports
+                final ExportedPackage[] packages = imports.toArray( new ExportedPackage[imports
                     .size()] );
-                Arrays.sort( packages, new Comparator()
+                Arrays.sort( packages, new Comparator<ExportedPackage>()
                 {
                     public int compare( ExportedPackage p1, ExportedPackage p2 )
                     {
                         return p1.getName().compareTo( p2.getName() );
                     }
-
-
-                    public int compare( Object o1, Object o2 )
-                    {
-                        return compare( ( ExportedPackage ) o1, ( ExportedPackage ) o2 );
-                    }
                 } );
                 // and finally print out
                 for ( int i = 0; i < packages.length; i++ )
@@ -888,9 +878,8 @@
         if ( !usingBundles.isEmpty() )
         {
             JSONArray val = new JSONArray();
-            for ( Iterator ui = usingBundles.values().iterator(); ui.hasNext(); )
+            for ( final Bundle usingBundle : usingBundles.values() )
             {
-                Bundle usingBundle = ( Bundle ) ui.next();
                 val.put( getBundleDescriptor( usingBundle, pluginRoot ) );
             }
             WebConsoleUtil.keyVal( jw, "Importing Bundles", val );
@@ -900,27 +889,22 @@
 
     private void listImportExportsUnresolved( JSONWriter jw, Bundle bundle, final String pluginRoot ) throws JSONException
     {
-        Dictionary dict = bundle.getHeaders();
+        @SuppressWarnings("unchecked")
+        Dictionary<String, String> dict = bundle.getHeaders();
 
-        String target = ( String ) dict.get( Constants.EXPORT_PACKAGE );
+        String target = dict.get( Constants.EXPORT_PACKAGE );
         if ( target != null )
         {
             Clause[] pkgs = Parser.parseHeader( target );
             if ( pkgs != null && pkgs.length > 0 )
             {
                 // do alphabetical sort
-                Arrays.sort( pkgs, new Comparator()
+                Arrays.sort( pkgs, new Comparator<Clause>()
                 {
                     public int compare( Clause p1, Clause p2 )
                     {
                         return p1.getName().compareTo( p2.getName() );
                     }
-
-
-                    public int compare( Object o1, Object o2 )
-                    {
-                        return compare( ( Clause) o1, ( Clause ) o2 );
-                    }
                 } );
 
                 JSONArray val = new JSONArray();
@@ -937,13 +921,13 @@
             }
         }
 
-        target = ( String ) dict.get( Constants.IMPORT_PACKAGE );
+        target = dict.get( Constants.IMPORT_PACKAGE );
         if ( target != null )
         {
             Clause[] pkgs = Parser.parseHeader( target );
             if ( pkgs != null && pkgs.length > 0 )
             {
-                Map imports = new TreeMap();
+                Map<String, Clause> imports = new TreeMap<String, Clause>();
                 for ( int i = 0; i < pkgs.length; i++ )
                 {
                     Clause pkg = pkgs[i];
@@ -951,7 +935,7 @@
                 }
 
                 // collect import packages first
-                final Map candidates = new HashMap();
+                final Map<String, ExportedPackage> candidates = new HashMap<String, ExportedPackage>();
                 PackageAdmin packageAdmin = getPackageAdmin();
                 if ( packageAdmin != null )
                 {
@@ -963,7 +947,7 @@
                         {
                             final ExportedPackage ep = exports[i];
 
-                            Clause imp = ( Clause ) imports.get( ep.getName() );
+                            Clause imp = imports.get( ep.getName() );
                             if ( imp != null && isSatisfied( imp, ep ) )
                             {
                                 candidates.put( ep.getName(), ep );
@@ -976,10 +960,8 @@
                 JSONArray val = new JSONArray();
                 if ( imports.size() > 0 )
                 {
-                    for ( Iterator ii = imports.values().iterator(); ii.hasNext(); )
-                    {
-                        Clause r4Import = ( Clause ) ii.next();
-                        ExportedPackage ep = ( ExportedPackage ) candidates.get( r4Import.getName() );
+                    for (final Clause r4Import : imports.values()) {
+                        ExportedPackage ep = candidates.get( r4Import.getName() );
 
                         // if there is no matching export, check whether this
                         // bundle has the package, ignore the entry in this case
@@ -1017,9 +999,9 @@
             val.append( id );
             val.append( "</a>" );
             return val.toString();
-        } else {
-            return id;
         }
+
+        return id;
     }
 
 
@@ -1058,8 +1040,9 @@
     {
         JSONArray val = new JSONArray();
 
-        Dictionary headers = bundle.getHeaders(""); // don't localize at all - raw headers
-        Enumeration he = headers.keys();
+        @SuppressWarnings("unchecked")
+        Dictionary<String, String> headers = bundle.getHeaders(""); // don't localize at all - raw headers
+        Enumeration<String> he = headers.keys();
         while ( he.hasMoreElements() )
         {
             Object header = he.nextElement();
@@ -1413,7 +1396,9 @@
     {
 
         // get the uploaded data
-        final Map params = ( Map ) request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
+        @SuppressWarnings("unchecked")
+        final Map<String, FileItem[]> params = ( Map<String, FileItem[]> ) request
+            .getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
         if ( params == null )
         {
             return;
@@ -1486,9 +1471,9 @@
     }
 
 
-    private FileItem getParameter( Map params, String name )
+    private FileItem getParameter( Map<String, FileItem[]> params, String name )
     {
-        FileItem[] items = ( FileItem[] ) params.get( name );
+        FileItem[] items = params.get( name );
         if ( items != null )
         {
             for ( int i = 0; i < items.length; i++ )
@@ -1505,10 +1490,10 @@
     }
 
 
-    private FileItem[] getFileItems( Map params, String name )
+    private FileItem[] getFileItems( Map<String, FileItem[]> params, String name )
     {
-        final List files = new ArrayList();
-        FileItem[] items = ( FileItem[] ) params.get( name );
+        final List<FileItem> files = new ArrayList<FileItem>();
+        FileItem[] items = params.get( name );
         if ( items != null )
         {
             for ( int i = 0; i < items.length; i++ )
@@ -1520,7 +1505,7 @@
             }
         }
 
-        return ( FileItem[] ) files.toArray( new FileItem[files.size()] );
+        return files.toArray( new FileItem[files.size()] );
     }
 
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
index 2e6f240..83b282d 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
@@ -20,6 +20,7 @@
 

 import java.io.PrintWriter;

 import java.lang.reflect.Method;

+import java.util.Enumeration;

 

 import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;

 import org.osgi.framework.BundleContext;

@@ -100,8 +101,8 @@
                 Method getAccessDecision = null;

                 try

                 {

-                    getAccessDecision = ConditionalPermissionInfo.class.getMethod(

-                        "getAccessDecision", null);

+                    getAccessDecision = ConditionalPermissionInfo.class.getMethod( "getAccessDecision",

+                        ( Class<?>[] ) null );

                 }

                 catch (Throwable t)

                 {

@@ -111,7 +112,7 @@
                 boolean hasPermissions = false;

                 //final java.util.List list = cpa.newConditionalPermissionUpdate().getConditionalPermissionInfos();

                 //for (int i = 0; list != null && i < list.size(); i++)

-                for (java.util.Enumeration e = cpa.getConditionalPermissionInfos(); e.hasMoreElements();)

+                for (Enumeration<?> e = cpa.getConditionalPermissionInfos(); e.hasMoreElements();)

                 {

                     hasPermissions = true;

                     //final ConditionalPermissionInfo info = (ConditionalPermissionInfo) list.get(i);

@@ -123,7 +124,7 @@
                     {

                         try

                         {

-                            final Object ad = getAccessDecision.invoke(info, null);

+                            final Object ad = getAccessDecision.invoke( info, ( Object[] ) null );

                             pw.print(" ("); //$NON-NLS-1$

                             pw.print(ad);

                             pw.print(")"); //$NON-NLS-1$

diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
index 47cfbd0..bde64de 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
@@ -46,6 +46,7 @@
 /**
  * ServicesServlet provides a plugin for inspecting the registered services.
  */
+@SuppressWarnings("serial")
 public class ServicesServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin
 {
     // don't create empty reference array all the time, create it only once - it is immutable
@@ -379,7 +380,7 @@
         // prepare variables
         DefaultVariableResolver vars = ( ( DefaultVariableResolver ) WebConsoleUtil.getVariableResolver( request ) );
         vars.put( "bundlePath", appRoot +  "/" + BundlesServlet.NAME + "/" );
-        vars.put( "drawDetails", reqInfo.serviceRequested ? Boolean.TRUE : Boolean.FALSE );
+        vars.put( "drawDetails", String.valueOf(reqInfo.serviceRequested));
         vars.put( "__data__", w.toString() );
 
         response.getWriter().print( TEMPLATE );
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
index 5d0441b..9fee9c2 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
@@ -32,28 +32,28 @@
  * So if both enumerations would produce the same result, say "123", only the
  * first would be returned.
  */
-class CombinedEnumeration implements Enumeration
+class CombinedEnumeration<E> implements Enumeration<E>
 {
 
     // the first enumeration to iterate
-    private final Enumeration first;
+    private final Enumeration<E> first;
 
     // the second enumeration to iterate once the first is exhausted
-    private final Enumeration second;
+    private final Enumeration<E> second;
 
     // the set of values already returned to prevent duplicate entries
-    private final Set seenKeys;
+    private final Set<E> seenKeys;
 
     // preview to the next return value for nextElement(), null at the end
-    private Object nextKey;
+    private E nextKey;
 
 
-    CombinedEnumeration( final Enumeration first, final Enumeration second )
+    CombinedEnumeration( final Enumeration<E> first, final Enumeration<E> second )
     {
         this.first = first;
         this.second = second;
 
-        this.seenKeys = new HashSet();
+        this.seenKeys = new HashSet<E>();
         this.nextKey = seek();
     }
 
@@ -64,14 +64,14 @@
     }
 
 
-    public Object nextElement()
+    public E nextElement()
     {
         if ( !hasMoreElements() )
         {
             throw new NoSuchElementException();
         }
 
-        Object result = nextKey;
+        E result = nextKey;
         nextKey = seek();
         return result;
     }
@@ -82,11 +82,11 @@
      * (unique) element is available, null is returned. The element returned
      * is also added to the set of seen elements to prevent duplicate provision
      */
-    private Object seek()
+    private E seek()
     {
         while ( first.hasMoreElements() )
         {
-            final Object next = first.nextElement();
+            final E next = first.nextElement();
             if ( !seenKeys.contains( next ) )
             {
                 seenKeys.add( next );
@@ -95,7 +95,7 @@
         }
         while ( second.hasMoreElements() )
         {
-            final Object next = second.nextElement();
+            final E next = second.nextElement();
             if ( !seenKeys.contains( next ) )
             {
                 seenKeys.add( next );
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
index eafc68e..a28ec5c 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
@@ -48,9 +48,9 @@
     }
 
 
-    public Enumeration getKeys()
+    public Enumeration<String> getKeys()
     {
-        return new CombinedEnumeration( resourceBundle.getKeys(), defaultResourceBundle.getKeys() );
+        return new CombinedEnumeration<String>( resourceBundle.getKeys(), defaultResourceBundle.getKeys() );
     }
 
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
index f70b07e..f31f18d 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
@@ -22,7 +22,10 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.util.Dictionary;
 import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.ResourceBundle;
 
@@ -32,14 +35,14 @@
 class ConsolePropertyResourceBundle extends ResourceBundle
 {
 
-    private final Properties props;
+    private final Dictionary<String, String> props;
 
 
     ConsolePropertyResourceBundle( final ResourceBundle parent, final URL source )
     {
         setParent( parent );
 
-        props = new Properties();
+        Properties props = new Properties();
         if ( source != null )
         {
             InputStream ins = null;
@@ -55,14 +58,19 @@
             {
                 IOUtils.closeQuietly( ins );
             }
+        }
 
+        this.props = new Hashtable<String, String>();
+        for ( Entry<?, ?> entry : props.entrySet() )
+        {
+            this.props.put( ( String ) entry.getKey(), ( String ) entry.getValue() );
         }
     }
 
 
-    public Enumeration getKeys()
+    public Enumeration<String> getKeys()
     {
-        return new CombinedEnumeration( props.keys(), parent.getKeys() );
+        return new CombinedEnumeration<String>( props.keys(), parent.getKeys() );
     }
 
 
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 bf3514e..eb84ead 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
@@ -46,15 +46,15 @@
 
     private final Bundle bundle;
 
-    private final Map resourceBundles;
+    private final Map<Locale, ResourceBundle> resourceBundles;
 
-    private Map resourceBundleEntries;
+    private Map<String, URL> resourceBundleEntries;
 
 
     ResourceBundleCache( final Bundle bundle )
     {
         this.bundle = bundle;
-        this.resourceBundles = new HashMap();
+        this.resourceBundles = new HashMap<Locale, ResourceBundle>();
     }
 
 
@@ -78,7 +78,7 @@
 
         synchronized ( resourceBundles )
         {
-            ResourceBundle bundle = ( ResourceBundle ) resourceBundles.get( locale );
+            ResourceBundle bundle = resourceBundles.get( locale );
             if ( bundle != null )
             {
                 return bundle;
@@ -99,12 +99,12 @@
     private ResourceBundle loadResourceBundle( final ResourceBundle parent, final Locale locale )
     {
         final String path = "_" + locale.toString(); //$NON-NLS-1$
-        final URL source = ( URL ) getResourceBundleEntries().get( path );
+        final URL source = getResourceBundleEntries().get( path );
         return new ConsolePropertyResourceBundle( parent, source );
     }
 
 
-    private synchronized Map getResourceBundleEntries()
+    private synchronized Map<String, URL> getResourceBundleEntries()
     {
         if ( this.resourceBundleEntries == null )
         {
@@ -125,14 +125,15 @@
             String fileName = file.substring( slash + 1 );
             String path = ( slash <= 0 ) ? "/" : file.substring( 0, slash ); //$NON-NLS-1$
 
-            HashMap resourceBundleEntries = new HashMap();
+            HashMap<String, URL> resourceBundleEntries = new HashMap<String, URL>();
 
-            Enumeration locales = bundle.findEntries( path, fileName + "*.properties", false ); //$NON-NLS-1$
+            @SuppressWarnings("unchecked")
+            Enumeration<URL> locales = bundle.findEntries( path, fileName + "*.properties", false ); //$NON-NLS-1$
             if ( locales != null )
             {
                 while ( locales.hasMoreElements() )
                 {
-                    URL entry = ( URL ) locales.nextElement();
+                    URL entry = locales.nextElement();
 
                     // calculate the key
                     String entryPath = entry.getPath();
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
index 03c9e70..c5b29cf 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
@@ -42,7 +42,7 @@
 
     private final ResourceBundleCache consoleResourceBundleCache;
 
-    private final Map resourceBundleCaches;
+    private final Map<Long, ResourceBundleCache> resourceBundleCaches;
 
 
     /**
@@ -54,7 +54,7 @@
     {
         this.bundleContext = bundleContext;
         this.consoleResourceBundleCache = new ResourceBundleCache( bundleContext.getBundle() );
-        this.resourceBundleCaches = new HashMap();
+        this.resourceBundleCaches = new HashMap<Long, ResourceBundleCache>();
 
         bundleContext.addBundleListener( this );
     }
@@ -75,7 +75,7 @@
      *
      * @param provider the bundle, provider of the resources
      * @param locale the requested locale.
-     * @return the resource bundle - if not bundle with the requested locale exists, 
+     * @return the resource bundle - if not bundle with the requested locale exists,
      *   the default locale is used.
      */
     public ResourceBundle getResourceBundle( final Bundle provider, final Locale locale )
@@ -92,7 +92,7 @@
         synchronized ( resourceBundleCaches )
         {
             Long key = new Long( provider.getBundleId() );
-            cache = ( ResourceBundleCache ) resourceBundleCaches.get( key );
+            cache = resourceBundleCaches.get( key );
             if ( cache == null )
             {
                 cache = new ResourceBundleCache( provider );
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
index fecafe0..99f1aef 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
@@ -41,7 +41,7 @@
     private Method attachmentMethod;
     private boolean checkedAttachmentMethod = false;
 
-    private static final List CUSTOM_MODES = new ArrayList();
+    private static final List<String> CUSTOM_MODES = new ArrayList<String>();
     static
     {
         CUSTOM_MODES.add( ConfigurationPrinter.MODE_TXT );
@@ -49,6 +49,7 @@
         CUSTOM_MODES.add( ConfigurationPrinter.MODE_ZIP );
     }
 
+    @SuppressWarnings("deprecation")
     public static ConfigurationPrinterAdapter createAdapter(
             final Object service,
             final ServiceReference ref)
@@ -258,7 +259,7 @@
     /**
      * Search a method with the given name and signature
      */
-    private static Method searchMethod(final Object obj, final String mName, final Class[] params)
+    private static Method searchMethod(final Object obj, final String mName, final Class<?>[] params)
     {
         try
         {
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 e000fac..3c21d35 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
@@ -42,6 +42,7 @@
  * representation of the current framework status. The content itself is
  *  internally generated by the {@link ConfigurationPrinter} plugins.
  */
+@SuppressWarnings("serial")
 public class ConfigurationRender extends SimpleWebConsolePlugin implements OsgiManagerPlugin
 {
 
@@ -68,7 +69,7 @@
 
     private int cfgPrinterTrackerCount;
 
-    private ArrayList configurationPrinters;
+    private ArrayList<ConfigurationPrinterAdapter> configurationPrinters;
 
     /** Default constructor */
     public ConfigurationRender( final ResourceBundleManager resourceBundleManager )
@@ -156,12 +157,12 @@
             pw.println ( "<html xmlns=\"http://www.w3.org/1999/xhtml\">" );
             pw.println ( "<head><title>dummy</title></head><body><div>" );
 
-            Collection printers = getPrintersForLabel(name);
+            Collection<ConfigurationPrinterAdapter> printers = getPrintersForLabel(name);
             if ( printers != null )
             {
-                for (Iterator i = printers.iterator(); i.hasNext();)
+                for (Iterator<ConfigurationPrinterAdapter> i = printers.iterator(); i.hasNext();)
                 {
-                    final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) i.next();
+                    final ConfigurationPrinterAdapter desc = i.next();
                     pw.enableFilter( desc.escapeHtml() );
                     printConfigurationPrinter( pw, desc, ConfigurationPrinter.MODE_WEB );
                     pw.enableFilter( false );
@@ -211,15 +212,14 @@
 
         // print headers only
         final String pluginRoot = request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT ) + "/";
-        Collection printers = getConfigurationPrinters();
-        for (Iterator i = printers.iterator(); i.hasNext();)
+        for ( final ConfigurationPrinterAdapter desc : getConfigurationPrinters() )
         {
-            final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) i.next();
             if ( desc.match( ConfigurationPrinter.MODE_WEB ) )
             {
                 final String label = desc.label;
                 final String title = desc.title;
-                pw.print("<li><a href='" + pluginRoot + URLEncoder.encode(label) + ".nfo'>" + title + "</a></li>" );
+                pw.print( "<li><a href='" + pluginRoot + URLEncoder.encode( label, "utf-8" ) + ".nfo'>" + title
+                    + "</a></li>" );
             }
         }
         pw.println("</ul> <!-- end tabs on top -->");
@@ -232,17 +232,17 @@
         pw.flush();
     }
 
-    private List getPrintersForLabel(final String label)
+    private List<ConfigurationPrinterAdapter> getPrintersForLabel(final String label)
     {
-        List list = null;
-        for ( Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
+        List<ConfigurationPrinterAdapter> list = null;
+        for ( Iterator<ConfigurationPrinterAdapter> cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
         {
-            final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) cpi.next();
+            final ConfigurationPrinterAdapter desc = cpi.next();
             if (desc.label.equals( label ) )
             {
                 if ( list == null )
                 {
-                    list = new ArrayList();
+                    list = new ArrayList<ConfigurationPrinterAdapter>();
                     list.add(desc);
                 }
             }
@@ -253,16 +253,16 @@
     private void printConfigurationStatus( ConfigurationWriter pw, final String mode, final String optionalLabel )
     {
         // check if we have printers for that label
-        Collection printers = getPrintersForLabel(optionalLabel);
+        Collection<ConfigurationPrinterAdapter> printers = getPrintersForLabel(optionalLabel);
         if ( printers == null )
         {
             // if not use all
             printers = getConfigurationPrinters();
         }
 
-        for ( Iterator cpi = printers.iterator(); cpi.hasNext(); )
+        for ( Iterator<ConfigurationPrinterAdapter> cpi = printers.iterator(); cpi.hasNext(); )
         {
-            final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) cpi.next();
+            final ConfigurationPrinterAdapter desc = cpi.next();
             if ( desc.match(mode) )
             {
                 printConfigurationPrinter( pw, desc, mode );
@@ -270,7 +270,7 @@
         }
     }
 
-    private final synchronized List getConfigurationPrinters()
+    private final synchronized List<ConfigurationPrinterAdapter> getConfigurationPrinters()
     {
         if ( cfgPrinterTracker == null )
         {
@@ -293,7 +293,7 @@
 
         if ( cfgPrinterTrackerCount != cfgPrinterTracker.getTrackingCount() )
         {
-            SortedMap cp = new TreeMap();
+            SortedMap<String, ConfigurationPrinterAdapter> cp = new TreeMap<String, ConfigurationPrinterAdapter>();
             ServiceReference[] refs = cfgPrinterTracker.getServiceReferences();
             if ( refs != null )
             {
@@ -311,7 +311,7 @@
                     }
                 }
             }
-            configurationPrinters = new ArrayList(cp.values());
+            configurationPrinters = new ArrayList<ConfigurationPrinterAdapter>(cp.values());
             cfgPrinterTrackerCount = cfgPrinterTracker.getTrackingCount();
         }
 
@@ -319,7 +319,7 @@
     }
 
 
-    private final void addConfigurationPrinter( final SortedMap printers,
+    private final void addConfigurationPrinter( final SortedMap<String, ConfigurationPrinterAdapter> printers,
             final ConfigurationPrinterAdapter desc,
             final Bundle provider)
     {
@@ -455,6 +455,7 @@
         abstract void end();
 
 
+        @SuppressWarnings("unused")
         public void handleAttachments( final String title, final URL[] urls ) throws IOException
         {
             throw new UnsupportedOperationException( "handleAttachments not supported by this configuration writer: "
@@ -556,20 +557,17 @@
     private void addAttachments( final ConfigurationWriter cf, final String mode )
     throws IOException
     {
-        for ( Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
+        for ( final ConfigurationPrinterAdapter desc : getConfigurationPrinters() )
         {
-            // check if printer supports zip mode
-            final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) cpi.next();
-            if ( desc.match(mode) )
+            if ( desc.match( mode ) )
             {
-                final URL[] attachments = desc.getAttachments(mode);
+                final URL[] attachments = desc.getAttachments( mode );
                 if ( attachments != null )
                 {
                     cf.handleAttachments( desc.title, attachments );
                 }
             }
         }
-
     }
 
     private static class PlainTextConfigurationWriter extends ConfigurationWriter
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
index 4b1ee96..e9f1aca 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
@@ -51,6 +51,7 @@
  *
  * TODO: add support for 'Bundle-License' manifest header
  */
+@SuppressWarnings("serial")
 public final class LicenseServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin
 {
     // common names (without extension) of the license files.
@@ -191,12 +192,13 @@
 
         for ( int i = 0; i < patterns.length; i++ )
         {
-            Enumeration entries = bundle.findEntries( "/", patterns[i] + "*", true );
+            @SuppressWarnings("unchecked")
+            Enumeration<URL> entries = bundle.findEntries( "/", patterns[i] + "*", true );
             if ( entries != null )
             {
                 while ( entries.hasMoreElements() )
                 {
-                    URL url = ( URL ) entries.nextElement();
+                    URL url = entries.nextElement();
                     JSONObject entry = new JSONObject();
                     entry.put( "path", url.getPath() );
                     entry.put( "url", getName( url.getPath() ) );
@@ -205,12 +207,13 @@
             }
         }
 
-        Enumeration entries = bundle.findEntries( "/", "*.jar", true );
+        @SuppressWarnings("unchecked")
+        Enumeration<URL> entries = bundle.findEntries( "/", "*.jar", true );
         if ( entries != null )
         {
             while ( entries.hasMoreElements() )
             {
-                URL url = ( URL ) entries.nextElement();
+                URL url = entries.nextElement();
                 final String resName = getName( url.getPath() );
 
                 InputStream ins = null;
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
index dbd71c6..09afb0c 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
@@ -33,6 +33,7 @@
 
     private static final String TITLE = "System Properties";
 
+    @SuppressWarnings("unused")
     private static final String LABEL = "_systemproperties";
 
 
@@ -45,13 +46,12 @@
     public void printConfiguration( PrintWriter printWriter )
     {
         Properties props = System.getProperties();
-        SortedSet keys = new TreeSet( props.keySet() );
-        for ( Iterator ki = keys.iterator(); ki.hasNext(); )
+        SortedSet<Object> keys = new TreeSet<Object>( props.keySet() );
+        for ( Iterator<Object> ki = keys.iterator(); ki.hasNext(); )
         {
             Object key = ki.next();
             ConfigurationRender.infoLine( printWriter, null, ( String ) key, props.get( key ) );
         }
-
     }
 
 }
\ No newline at end of file
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
index 2ea8f35..116e1e3 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
@@ -29,6 +29,7 @@
 
     private static final String TITLE = "Threads";
 
+    @SuppressWarnings("unused")
     private static final String LABEL = "_threads";
 
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java
index 7c44402..16670b3 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java
@@ -1072,7 +1072,7 @@
         try {
             return new String(bytes, "UTF-8");
         } catch (UnsupportedEncodingException e) {
-            throw new IllegalStateException("UTF-8", e);
+            throw new IllegalStateException("UTF-8");
         }
     }
 
@@ -1083,7 +1083,7 @@
         try {
             return string.getBytes("UTF-8");
         } catch (UnsupportedEncodingException e) {
-            throw new IllegalStateException("UTF-8", e);
+            throw new IllegalStateException("UTF-8");
         }
     }
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
index 87592b2..35f114b 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
@@ -44,7 +44,7 @@
     {
         final OsgiManager osgiManager = listener.osgiManager;
 
-        Dictionary props = new Hashtable();
+        Dictionary<String, String> props = new Hashtable<String, String>();
         props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" );
         props.put( Constants.SERVICE_DESCRIPTION, "OSGi Management Console Configuration Receiver" );
         props.put( Constants.SERVICE_PID, osgiManager.getConfigurationPid() );
@@ -61,7 +61,8 @@
 
     //---------- ManagedService
 
-    public void updated( Dictionary config )
+    @SuppressWarnings("unchecked")
+    public void updated( @SuppressWarnings("rawtypes") Dictionary config )
     {
         osgiManager.updateConfiguration( config );
     }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java
index efcef71..07dbb7f 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java
@@ -42,7 +42,7 @@
     private String ocdLocale;
     private ObjectClassDefinition ocd;
     private final OsgiManager osgiManager;
-    
+
     private static final String[] CONF_PROPS = new String[] {
         OsgiManager.PROP_MANAGER_ROOT, OsgiManager.DEFAULT_MANAGER_ROOT, //
         OsgiManager.PROP_HTTP_SERVICE_SELECTOR, OsgiManager.DEFAULT_HTTP_SERVICE_SELECTOR, //
@@ -79,7 +79,7 @@
         // there is no locale support here
         return null;
     }
-    
+
     static final String getString(ResourceBundle rb, String key, String def)
     {
         try
@@ -100,7 +100,7 @@
         }
 
         if (locale == null) locale = Locale.ENGLISH.getLanguage();
-        
+
         // check if OCD is already initialized and it's locale is the same as the requested one
         synchronized (ocdLock)
         {
@@ -115,7 +115,7 @@
         final ResourceBundle rb = osgiManager.resourceBundleManager.getResourceBundle(osgiManager.getBundleContext().getBundle(), localeObj);
 
         // simple configuration properties
-        final ArrayList adList = new ArrayList();
+        final ArrayList<AttributeDefinition> adList = new ArrayList<AttributeDefinition>();
         for (int i = 0; i < CONF_PROPS.length; i++)
         {
             final String key = CONF_PROPS[i++];
@@ -124,15 +124,15 @@
             final String descr = getString(rb, "metadata." + key + ".description", key); //$NON-NLS-1$ //$NON-NLS-2$
             adList.add( new AttributeDefinitionImpl(key, name, descr, defaultValue) );
         }
-        
+
         // log level is select - so no simple default value; requires localized option labels
-        adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_LOG_LEVEL, 
+        adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_LOG_LEVEL,
             getString(rb, "metadata.loglevel.name", OsgiManager.PROP_LOG_LEVEL), //$NON-NLS-1$
             getString(rb, "metadata.loglevel.description", OsgiManager.PROP_LOG_LEVEL), //$NON-NLS-1$
-            AttributeDefinition.INTEGER, // type 
-            new String[] { String.valueOf( OsgiManager.DEFAULT_LOG_LEVEL ) }, // default values 
-            0, // cardinality 
-            new String[] { // option labels 
+            AttributeDefinition.INTEGER, // type
+            new String[] { String.valueOf( OsgiManager.DEFAULT_LOG_LEVEL ) }, // default values
+            0, // cardinality
+            new String[] { // option labels
                 getString(rb, "log.level.debug", "Debug"), //$NON-NLS-1$ //$NON-NLS-2$
                 getString(rb, "log.level.info", "Information"), //$NON-NLS-1$ //$NON-NLS-2$
                 getString(rb, "log.level.warn", "Warn"), //$NON-NLS-1$ //$NON-NLS-2$
@@ -141,7 +141,7 @@
             new String[] { "4", "3", "2", "1" } ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 
         // list plugins - requires localized plugin titles
-        final TreeMap namesByClassName = new TreeMap();
+        final TreeMap<String, String> namesByClassName = new TreeMap<String, String>();
         final String[] defaultPluginsClasses = OsgiManager.PLUGIN_MAP;
         for ( int i = 0; i < defaultPluginsClasses.length; i++ )
         {
@@ -150,11 +150,11 @@
             final String name = getString(rb, label + ".pluginTitle", label); //$NON-NLS-1$
             namesByClassName.put(clazz, name);
         }
-        final String[] classes = ( String[] ) namesByClassName.keySet().toArray(
+        final String[] classes = namesByClassName.keySet().toArray(
             new String[namesByClassName.size()] );
-        final String[] names = ( String[] ) namesByClassName.values().toArray( new String[namesByClassName.size()] );
+        final String[] names = namesByClassName.values().toArray( new String[namesByClassName.size()] );
 
-        adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_ENABLED_PLUGINS, 
+        adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_ENABLED_PLUGINS,
             getString(rb, "metadata.plugins.name", OsgiManager.PROP_ENABLED_PLUGINS), //$NON-NLS-1$
             getString(rb, "metadata.plugins.description", OsgiManager.PROP_ENABLED_PLUGINS), //$NON-NLS-1$
             AttributeDefinition.STRING, classes, Integer.MIN_VALUE, names, classes ) );
@@ -162,7 +162,7 @@
         xocd = new ObjectClassDefinition()
         {
 
-            private final AttributeDefinition[] attrs = ( AttributeDefinition[] ) adList
+            private final AttributeDefinition[] attrs = adList
                 .toArray( new AttributeDefinition[adList.size()] );
 
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
index f2e556b..7d743ff 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
@@ -42,7 +42,7 @@
      * @return The value of the named property as a string or <code>def</code>

      *         if the property does not exist

      */

-    public static final String getProperty(Dictionary config, String name, String def)

+    public static final String getProperty(Dictionary<String, ?> config, String name, String def)

     {

         Object value = config.get(name);

         if (value instanceof String)

@@ -68,7 +68,7 @@
      * @return The value of the named property as a string or <code>def</code>

      *         if the property does not exist

      */

-    public static final int getProperty(Dictionary config, String name, int def)

+    public static final int getProperty(Dictionary<String, ?> config, String name, int def)

     {

         Object value = config.get(name);

         if (value instanceof Number)

@@ -95,12 +95,12 @@
 

     /**

      * Gets a property as String[]

-     * 

+     *

      * @param config The properties from which to returned the named one

      * @param name The name of the property to return

      * @return the property value as string array - no matter if originally it was other kind of array, collection or comma-separated string. Returns <code>null</code> if the property is not set.

      */

-    public static final String[] getStringArrayProperty(Dictionary config, String name)

+    public static final String[] getStringArrayProperty(Dictionary<String, ?> config, String name)

     {

         Object value = config.get(name);

         if (value == null)

@@ -120,10 +120,10 @@
         }

         else if (value instanceof Collection)

         {

-            Collection collection = (Collection) value;

+            Collection<?> collection = (Collection<?>) value;

             ret = new String[collection.size()];

             int i = 0;

-            for (Iterator iter = collection.iterator(); iter.hasNext();)

+            for (Iterator<?> iter = collection.iterator(); iter.hasNext();)

             {

                 ret[i] = String.valueOf(iter.next());

                 i++;

diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
index d9bd052..b778a72 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
@@ -180,7 +180,7 @@
 
     // list of OsgiManagerPlugin instances activated during init. All these
     // instances will have to be deactivated during destroy
-    private List osgiManagerPlugins = new ArrayList();
+    private List<OsgiManagerPlugin> osgiManagerPlugins = new ArrayList<OsgiManagerPlugin>();
 
     private String webManagerRoot;
 
@@ -190,12 +190,12 @@
     // true if the resources have been registered with the HttpService
     private boolean httpResourcesRegistered;
 
-    private Dictionary configuration;
+    private Dictionary<String, ?> configuration;
 
     // See https://issues.apache.org/jira/browse/FELIX-2267
     private Locale configuredLocale;
 
-    private Set enabledPlugins;
+    private Set<String> enabledPlugins;
 
     ResourceBundleManager resourceBundleManager;
 
@@ -222,13 +222,13 @@
 
             try
             {
-                Class pluginClass = classLoader.loadClass(pluginClassName);
+                Class<?> pluginClass = classLoader.loadClass(pluginClassName);
                 Object plugin = pluginClass.newInstance();
 
                 if (plugin instanceof OsgiManagerPlugin)
                 {
                     ((OsgiManagerPlugin) plugin).activate(bundleContext);
-                    osgiManagerPlugins.add(plugin);
+                    osgiManagerPlugins.add((OsgiManagerPlugin) plugin);
                 }
                 if (plugin instanceof BrandingPlugin)
                 {
@@ -321,10 +321,9 @@
         }
 
         // deactivate any remaining plugins
-        for (Iterator pi = osgiManagerPlugins.iterator(); pi.hasNext();)
+        for ( Iterator<OsgiManagerPlugin> pi = osgiManagerPlugins.iterator(); pi.hasNext(); )
         {
-            Object plugin = pi.next();
-            ((OsgiManagerPlugin) plugin).deactivate();
+            pi.next().deactivate();
         }
 
         // simply remove all operations, we should not be used anymore
@@ -410,8 +409,7 @@
         AbstractWebConsolePlugin plugin = getConsolePlugin(label);
         if (plugin != null)
         {
-            final Map labelMap = holder.getLocalizedLabelMap(resourceBundleManager,
-                locale);
+            final Map<String, String> labelMap = holder.getLocalizedLabelMap( resourceBundleManager, locale );
 
             // the official request attributes
             request.setAttribute(WebConsoleConstants.ATTR_LANG_MAP, getLangMap());
@@ -667,12 +665,9 @@
 
     private static class BrandingServiceTracker extends ServiceTracker
     {
-        private final OsgiManager osgiManager; // FIXME: never read locally
-
         BrandingServiceTracker(OsgiManager osgiManager)
         {
             super(osgiManager.getBundleContext(), BrandingPlugin.class.getName(), null);
-            this.osgiManager = osgiManager;
         }
 
         public Object addingService(ServiceReference reference)
@@ -706,7 +701,7 @@
             return;
         }
 
-        Dictionary config = getConfiguration();
+        Dictionary<String, ?> config = getConfiguration();
 
         // get authentication details
         String realm = ConfigurationUtil.getProperty(config, PROP_REALM, DEFAULT_REALM);
@@ -719,7 +714,7 @@
             HttpContext httpContext = new OsgiManagerHttpContext(httpService,
                 securityProviderTracker, userId, password, realm);
 
-            Dictionary servletConfig = toStringConfig(config);
+            Dictionary<String, String> servletConfig = toStringConfig(config);
 
             // register this servlet and take note of this
             httpService.registerServlet(this.webManagerRoot, this, servletConfig,
@@ -781,16 +776,16 @@
         }
     }
 
-    private Dictionary getConfiguration()
+    private Dictionary<String, ?> getConfiguration()
     {
         return configuration;
     }
 
-    synchronized void updateConfiguration(Dictionary config)
+    synchronized void updateConfiguration(Dictionary<String, ?> config)
     {
         if (config == null)
         {
-            config = new Hashtable();
+            config = new Hashtable<String, Object>();
         }
 
         configuration = config;
@@ -825,7 +820,7 @@
 
         // get enabled plugins
         String[] plugins = ConfigurationUtil.getStringArrayProperty(config, PROP_ENABLED_PLUGINS);
-        enabledPlugins = null == plugins ? null : new HashSet(Arrays.asList(plugins));
+        enabledPlugins = null == plugins ? null : new HashSet<String>(Arrays.asList(plugins));
         initInternalPlugins();
 
         // might update HTTP service registration
@@ -891,36 +886,41 @@
         return enabledPlugins != null && !enabledPlugins.contains(pluginClass);
     }
 
-    private Dictionary toStringConfig(Dictionary config)
+    private Dictionary<String, String> toStringConfig(Dictionary<String, ?> config)
     {
-        Dictionary stringConfig = new Hashtable();
-        for (Enumeration ke = config.keys(); ke.hasMoreElements();)
+        Dictionary<String, String> stringConfig = new Hashtable<String, String>();
+        for (Enumeration<String> ke = config.keys(); ke.hasMoreElements();)
         {
-            Object key = ke.nextElement();
-            stringConfig.put(key.toString(), String.valueOf(config.get(key)));
+            String key = ke.nextElement();
+            stringConfig.put(key, String.valueOf(config.get(key)));
         }
         return stringConfig;
     }
 
-    private Map langMap;
+    private Map<String, String> langMap;
 
-    private final Map getLangMap()
+
+    private final Map<String, String> getLangMap()
     {
-        if (null != langMap)
-            return langMap;
-        final Map map = new HashMap();
-        final Bundle bundle = bundleContext.getBundle();
-        final Enumeration e = bundle.findEntries("res/flags", null, false); //$NON-NLS-1$
-        while (e != null && e.hasMoreElements())
+        if ( null != langMap )
         {
-            final URL img = (URL) e.nextElement();
-            final String name = FilenameUtils.getBaseName(img.getFile());
+            return langMap;
+        }
+
+        final Map<String, String> map = new HashMap<String, String>();
+        final Bundle bundle = bundleContext.getBundle();
+        @SuppressWarnings("unchecked")
+        final Enumeration<URL> e = bundle.findEntries( "res/flags", null, false ); //$NON-NLS-1$
+        while ( e != null && e.hasMoreElements() )
+        {
+            final URL img = e.nextElement();
+            final String name = FilenameUtils.getBaseName( img.getFile() );
             try
             {
-                final String locale = new Locale(name, "").getDisplayLanguage(); //$NON-NLS-1$
-                map.put(name, null != locale ? locale : name);
+                final String locale = new Locale( name, "" ).getDisplayLanguage(); //$NON-NLS-1$
+                map.put( name, null != locale ? locale : name );
             }
-            catch (Throwable t)
+            catch ( Throwable t )
             {
                 t.printStackTrace();
                 /* ignore invalid locale? */
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
index 95a9770..04a3879 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
@@ -57,7 +57,7 @@
     private final BundleContext bundleContext;
 
     // registered plugins (Map<String label, Plugin plugin>)
-    private final Map plugins;
+    private final Map<String, Plugin> plugins;
 
     // The servlet context used to initialize plugin services
     private ServletContext servletContext;
@@ -69,7 +69,7 @@
     PluginHolder( final BundleContext context )
     {
         this.bundleContext = context;
-        this.plugins = new HashMap();
+        this.plugins = new HashMap<String, Plugin>();
     }
 
 
@@ -197,7 +197,7 @@
             final Plugin plugin;
             synchronized ( plugins )
             {
-                plugin = ( Plugin ) plugins.get( label );
+                plugin = plugins.get( label );
             }
 
             if ( plugin != null )
@@ -232,9 +232,9 @@
      *
      * @return The localized map of labels to titles
      */
-    Map getLocalizedLabelMap( final ResourceBundleManager resourceBundleManager, final Locale locale )
+    Map<String, String> getLocalizedLabelMap( final ResourceBundleManager resourceBundleManager, final Locale locale )
     {
-        final Map map = new HashMap();
+        final Map<String, String> map = new HashMap<String, String>();
         Plugin[] plugins = getPlugins();
         for ( int i = 0; i < plugins.length; i++ )
         {
@@ -386,7 +386,7 @@
         final Plugin oldPlugin;
         synchronized ( plugins )
         {
-            oldPlugin = ( Plugin ) plugins.remove( label );
+            oldPlugin = plugins.remove( label );
         }
 
         if ( oldPlugin != null )
@@ -400,7 +400,7 @@
     {
         synchronized ( plugins )
         {
-            return ( Plugin[] ) plugins.values().toArray( new Plugin[plugins.size()] );
+            return plugins.values().toArray( new Plugin[plugins.size()] );
         }
     }
 
@@ -562,7 +562,7 @@
         }
 
 
-        protected void doUngetConsolePlugin( AbstractWebConsolePlugin consolePlugin )
+        protected void doUngetConsolePlugin( @SuppressWarnings("unused") AbstractWebConsolePlugin consolePlugin )
         {
         }
 
@@ -575,9 +575,9 @@
         }
 
 
-        public Enumeration getInitParameterNames()
+        public Enumeration<String> getInitParameterNames()
         {
-            return new Enumeration()
+            return new Enumeration<String>()
             {
                 public boolean hasMoreElements()
                 {
@@ -585,7 +585,7 @@
                 }
 
 
-                public Object nextElement()
+                public String nextElement()
                 {
                     throw new NoSuchElementException();
                 }
@@ -643,22 +643,6 @@
             return super.doGetTitle();
         }
 
-        /**
-         * If the plugin is registered as a regular OSGi service, this method
-         * behaves the same as {@link #dispose()}. If the plugin is built
-         * into the web console, this method does nothing.
-         * <p>
-         * After this method is called, the plugin may still be used because
-         * the {@link #getConsolePlugin()} method will re-acquire the service
-         * again on-demand.
-         */
-        final void ungetService()
-        {
-            // FIXME: this method is used by nobody!?!?
-            dispose();
-        }
-
-
         protected AbstractWebConsolePlugin doGetConsolePlugin()
         {
             Object service = getHolder().getBundleContext().getService( serviceReference );
@@ -698,10 +682,10 @@
         }
 
 
-        public Enumeration getInitParameterNames()
+        public Enumeration<String> getInitParameterNames()
         {
             final String[] keys = serviceReference.getPropertyKeys();
-            return new Enumeration()
+            return new Enumeration<String>()
             {
                 int idx = 0;
 
@@ -712,7 +696,7 @@
                 }
 
 
-                public Object nextElement()
+                public String nextElement()
                 {
                     if ( hasMoreElements() )
                     {
@@ -760,7 +744,7 @@
 
                 try
                 {
-                    Class pluginClass = getClass().getClassLoader().loadClass(pluginClassName);
+                    Class<?> pluginClass = getClass().getClassLoader().loadClass(pluginClassName);
                     plugin = (AbstractWebConsolePlugin) pluginClass.newInstance();
 
                     if (plugin instanceof OsgiManagerPlugin)
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
index 556b8bd..ad8da4b 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
@@ -43,6 +43,7 @@
  * VMStatPlugin provides the System Information tab. This particular plugin uses
  * more than one templates.
  */
+@SuppressWarnings("serial")
 public class VMStatPlugin extends SimpleWebConsolePlugin implements OsgiManagerPlugin
 {
 
@@ -166,8 +167,7 @@
     /**
      * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
-    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
-        IOException
+    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         String body;
 
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java b/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java
index 3f43587..43d3c28 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java
@@ -30,7 +30,7 @@
  * <dd>Service API to provide custom authentication and access control.</dd>
  * </dl>
  */
-@Version("3.1.2")
+@Version("3.1.4")
 @Export(optional = "provide:=true")
 package org.apache.felix.webconsole;
 
diff --git a/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java b/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
index b5db480..4052081 100644
--- a/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
+++ b/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
@@ -28,6 +28,7 @@
 import junit.framework.TestCase;
 
 
+@SuppressWarnings("serial")
 public class AbstractWebConsolePluginTest extends TestCase
 {
 
@@ -38,7 +39,8 @@
     {
         super.setUp();
 
-        getGetResourceMethod = AbstractWebConsolePlugin.class.getDeclaredMethod( "getGetResourceMethod", null );
+        getGetResourceMethod = AbstractWebConsolePlugin.class.getDeclaredMethod( "getGetResourceMethod",
+            ( Class<?>[] ) null );
         getGetResourceMethod.setAccessible( true );
     }
 
@@ -55,12 +57,12 @@
             }
         };
         assertNull( test.getResourceProvider() );
-        assertNull( getGetResourceMethod.invoke( test, null ) );
+        assertNull( getGetResourceMethod.invoke( test, (Object[]) null ) );
 
         // test with default resource provider but no method
         final TestPlugin test2 = new TestPlugin();
         assertEquals( test2, test2.getResourceProvider() );
-        assertNull( getGetResourceMethod.invoke( test2, null ) );
+        assertNull( getGetResourceMethod.invoke( test2, (Object[]) null ) );
     }
 
 
@@ -69,22 +71,22 @@
         // test with default resource provider, public method
         final TestPlugin testPublic = new PublicTestPlugin();
         assertEquals( testPublic, testPublic.getResourceProvider() );
-        assertNotNull( getGetResourceMethod.invoke( testPublic, null ) );
+        assertNotNull( getGetResourceMethod.invoke( testPublic, (Object[]) null ) );
 
         // test with default resource provider, package private method
         final TestPlugin testDefault = new PackageTestPlugin();
         assertEquals( testDefault, testDefault.getResourceProvider() );
-        assertNull( getGetResourceMethod.invoke( testDefault, null ) );
+        assertNull( getGetResourceMethod.invoke( testDefault, (Object[]) null ) );
 
         // test with default resource provider, protected method
         final TestPlugin testProtected = new ProtectedTestPlugin();
         assertEquals( testProtected, testProtected.getResourceProvider() );
-        assertNotNull( getGetResourceMethod.invoke( testProtected, null ) );
+        assertNotNull( getGetResourceMethod.invoke( testProtected, (Object[]) null ) );
 
         // test with default resource provider, private method
         final TestPlugin testPrivate = new PrivateTestPlugin();
         assertEquals( testPrivate, testPrivate.getResourceProvider() );
-        assertNotNull( getGetResourceMethod.invoke( testPrivate, null ) );
+        assertNotNull( getGetResourceMethod.invoke( testPrivate, (Object[]) null ) );
     }
 
 
@@ -95,32 +97,33 @@
         {
         };
         assertEquals( testPublic, testPublic.getResourceProvider() );
-        assertNotNull( getGetResourceMethod.invoke( testPublic, null ) );
+        assertNotNull( getGetResourceMethod.invoke( testPublic, (Object[]) null ) );
 
         // test with default resource provider, package private method
         final TestPlugin testDefault = new PackageTestPlugin()
         {
         };
         assertEquals( testDefault, testDefault.getResourceProvider() );
-        assertNull( getGetResourceMethod.invoke( testDefault, null ) );
+        assertNull( getGetResourceMethod.invoke( testDefault, (Object[]) null ) );
 
         // test with default resource provider, protected method
         final TestPlugin testProtected = new ProtectedTestPlugin()
         {
         };
         assertEquals( testProtected, testProtected.getResourceProvider() );
-        assertNotNull( getGetResourceMethod.invoke( testProtected, null ) );
+        assertNotNull( getGetResourceMethod.invoke( testProtected, (Object[]) null ) );
 
         // test with default resource provider, private method
         final TestPlugin testPrivate = new PrivateTestPlugin()
         {
         };
         assertEquals( testPrivate, testPrivate.getResourceProvider() );
-        assertNull( getGetResourceMethod.invoke( testPrivate, null ) );
+        assertNull( getGetResourceMethod.invoke( testPrivate, (Object[]) null ) );
     }
 
     private static class PrivateTestPlugin extends TestPlugin
     {
+        @SuppressWarnings("unused")
         private URL getResource( String name )
         {
             return null;
@@ -129,6 +132,7 @@
 
     private static class ProtectedTestPlugin extends TestPlugin
     {
+        @SuppressWarnings("unused")
         protected URL getResource( String name )
         {
             return null;
@@ -137,6 +141,7 @@
 
     private static class PackageTestPlugin extends TestPlugin
     {
+        @SuppressWarnings("unused")
         URL getResource( String name )
         {
             return null;
@@ -145,6 +150,7 @@
 
     private static class PublicTestPlugin extends TestPlugin
     {
+        @SuppressWarnings("unused")
         public URL getResource( String name )
         {
             return null;