You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2011/12/17 19:11:17 UTC
svn commit: r1215540 [1/2] - in /felix/trunk/webconsole: ./
src/main/java/org/apache/felix/webconsole/
src/main/java/org/apache/felix/webconsole/internal/
src/main/java/org/apache/felix/webconsole/internal/compendium/
src/main/java/org/apache/felix/web...
Author: fmeschbe
Date: Sat Dec 17 18:11:16 2011
New Revision: 1215540
URL: http://svn.apache.org/viewvc?rev=1215540&view=rev
Log:
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
Modified:
felix/trunk/webconsole/pom.xml
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java
felix/trunk/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
Modified: felix/trunk/webconsole/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/pom.xml?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/pom.xml (original)
+++ felix/trunk/webconsole/pom.xml Sat Dec 17 18:11:16 2011
@@ -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>
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java Sat Dec 17 18:11:16 2011
@@ -22,6 +22,7 @@ import java.lang.reflect.*;
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 @@ public abstract class AbstractWebConsole
* @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 @@ public abstract class AbstractWebConsole
{
try
{
- Class cl = resourceProvider.getClass();
+ Class<?> cl = resourceProvider.getClass();
while ( tmpGetResourceMethod == null && cl != Object.class )
{
Method[] methods = cl.getDeclaredMethods();
@@ -590,15 +591,14 @@ public abstract class AbstractWebConsole
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 @@ public abstract class AbstractWebConsole
// 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 @@ public abstract class AbstractWebConsole
}
// 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 @@ public abstract class AbstractWebConsole
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 @@ public abstract class AbstractWebConsole
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 )
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java Sat Dec 17 18:11:16 2011
@@ -31,7 +31,7 @@ import java.util.Map;
* {@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 @@ public class DefaultVariableResolver ext
/**
* 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 @@ public class DefaultVariableResolver ext
/**
* 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 @@ public class DefaultVariableResolver ext
/**
* 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 );
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java Sat Dec 17 18:11:16 2011
@@ -22,7 +22,6 @@ package org.apache.felix.webconsole;
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 @@ public abstract class SimpleWebConsolePl
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 @@ public abstract class SimpleWebConsolePl
{
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 abstract class SimpleWebConsolePl
*/
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 abstract class SimpleWebConsolePl
*/
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();
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java Sat Dec 17 18:11:16 2011
@@ -23,7 +23,6 @@ import java.io.IOException;
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 @@ public final class WebConsoleUtil
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 @@ public final class WebConsoleUtil
}
// 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 @@ public final class WebConsoleUtil
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 @@ public final class WebConsoleUtil
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 @@ public final class WebConsoleUtil
* @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
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java Sat Dec 17 18:11:16 2011
@@ -133,21 +133,21 @@ public class Util
* @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 @@ public class Util
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 class Util
}
- public int compare( Object o1, Object o2 )
- {
- return compare( ( Bundle ) o1, ( Bundle ) o2 );
- }
-
-
public int compare( Bundle b1, Bundle b2 )
{
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java Sat Dec 17 18:11:16 2011
@@ -248,14 +248,14 @@ public class WebConsolePluginAdapter ext
}
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 @@ public class WebConsolePluginAdapter ext
{
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() );
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java Sat Dec 17 18:11:16 2011
@@ -40,6 +40,7 @@ import org.osgi.service.metatype.ObjectC
/**
* The <code>ConfigManager</code> TODO
*/
+@SuppressWarnings("serial")
public class ConfigManager extends ConfigManagerBase
{
private static final String LABEL = "configMgr"; // was name
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java Sat Dec 17 18:11:16 2011
@@ -75,7 +75,7 @@ abstract class ConfigManagerBase extends
* @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 @@ abstract class ConfigManagerBase extends
* @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 @@ abstract class ConfigManagerBase extends
* @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 @@ abstract class ConfigManagerBase extends
}
- 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 )
{
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java Sat Dec 17 18:11:16 2011
@@ -71,15 +71,15 @@ public class ConfigurationAdminConfigura
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 @@ public class ConfigurationAdminConfigura
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 ) );
}
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java Sat Dec 17 18:11:16 2011
@@ -39,6 +39,7 @@ import org.osgi.service.log.LogService;
/**
* 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 @@ public class LogServlet extends SimpleWe
/**
* @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 @@ public class LogServlet extends SimpleWe
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 @@ public class LogServlet extends SimpleWe
/**
* @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 @@ public class LogServlet extends SimpleWe
private static final String serviceDescription( ServiceReference serviceReference )
{
if ( serviceReference == null )
+ {
return "";
- else
- return serviceReference.toString();
+ }
+ return serviceReference.toString();
}
@@ -199,9 +200,10 @@ public class LogServlet extends SimpleWe
private static final String exceptionMessage( Throwable e )
{
if ( e == null )
+ {
return "";
- else
- return e.getClass().getName()+": "+e.getMessage();
+ }
+ return e.getClass().getName() + ": " + e.getMessage();
}
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java Sat Dec 17 18:11:16 2011
@@ -170,7 +170,7 @@ public final class WireAdminConfiguratio
}
}
- Class[] flavors = wire.getFlavors();
+ Class<?>[] flavors = wire.getFlavors();
if (flavors == null)
{
pw.println(" Flavors: none");
@@ -187,7 +187,7 @@ public final class WireAdminConfiguratio
pw.println();
}
- Dictionary props = wire.getProperties();
+ Dictionary<?, ?> props = wire.getProperties();
if (props == null)
{
pw.println(" Properties: none");
@@ -195,7 +195,7 @@ public final class WireAdminConfiguratio
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$
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java Sat Dec 17 18:11:16 2011
@@ -20,7 +20,6 @@ package org.apache.felix.webconsole.inte
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 @@ public class BundlesConfigurationPrinter
{
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 @@ public class BundlesConfigurationPrinter
}
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 );
}
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java Sat Dec 17 18:11:16 2011
@@ -49,6 +49,7 @@ import org.osgi.service.startlevel.Start
* 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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
/**
* @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 @@ public class BundlesServlet extends Simp
// 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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
}
}
- 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 @@ public class BundlesServlet extends Simp
}
// 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 @@ public class BundlesServlet extends Simp
{
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 @@ public class BundlesServlet extends Simp
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 @@ public class BundlesServlet extends Simp
val.append( id );
val.append( "</a>" );
return val.toString();
- } else {
- return id;
}
+
+ return id;
}
@@ -1058,8 +1040,9 @@ public class BundlesServlet extends Simp
{
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 @@ public class BundlesServlet extends Simp
{
// 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 @@ public class BundlesServlet extends Simp
}
- 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 @@ public class BundlesServlet extends Simp
}
- 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 @@ public class BundlesServlet extends Simp
}
}
- return ( FileItem[] ) files.toArray( new FileItem[files.size()] );
+ return files.toArray( new FileItem[files.size()] );
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java Sat Dec 17 18:11:16 2011
@@ -20,6 +20,7 @@ package org.apache.felix.webconsole.inte
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 @@ public final class PermissionsConfigurat
Method getAccessDecision = null;
try
{
- getAccessDecision = ConditionalPermissionInfo.class.getMethod(
- "getAccessDecision", null);
+ getAccessDecision = ConditionalPermissionInfo.class.getMethod( "getAccessDecision",
+ ( Class<?>[] ) null );
}
catch (Throwable t)
{
@@ -111,7 +112,7 @@ public final class PermissionsConfigurat
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 @@ public final class PermissionsConfigurat
{
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$
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java Sat Dec 17 18:11:16 2011
@@ -46,6 +46,7 @@ import org.osgi.framework.ServiceReferen
/**
* 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 @@ public class ServicesServlet extends Sim
// 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 );
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java Sat Dec 17 18:11:16 2011
@@ -32,28 +32,28 @@ import java.util.Set;
* 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 @@ class CombinedEnumeration implements Enu
}
- 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 @@ class CombinedEnumeration implements Enu
* (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 @@ class CombinedEnumeration implements Enu
}
while ( second.hasMoreElements() )
{
- final Object next = second.nextElement();
+ final E next = second.nextElement();
if ( !seenKeys.contains( next ) )
{
seenKeys.add( next );
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java Sat Dec 17 18:11:16 2011
@@ -48,9 +48,9 @@ class CombinedResourceBundle extends Res
}
- public Enumeration getKeys()
+ public Enumeration<String> getKeys()
{
- return new CombinedEnumeration( resourceBundle.getKeys(), defaultResourceBundle.getKeys() );
+ return new CombinedEnumeration<String>( resourceBundle.getKeys(), defaultResourceBundle.getKeys() );
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java Sat Dec 17 18:11:16 2011
@@ -22,7 +22,10 @@ package org.apache.felix.webconsole.inte
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 @@ import org.apache.commons.io.IOUtils;
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 @@ class ConsolePropertyResourceBundle exte
{
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() );
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java Sat Dec 17 18:11:16 2011
@@ -46,15 +46,15 @@ class ResourceBundleCache
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 @@ class ResourceBundleCache
synchronized ( resourceBundles )
{
- ResourceBundle bundle = ( ResourceBundle ) resourceBundles.get( locale );
+ ResourceBundle bundle = resourceBundles.get( locale );
if ( bundle != null )
{
return bundle;
@@ -99,12 +99,12 @@ class ResourceBundleCache
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 @@ class ResourceBundleCache
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();
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java Sat Dec 17 18:11:16 2011
@@ -42,7 +42,7 @@ public class ResourceBundleManager imple
private final ResourceBundleCache consoleResourceBundleCache;
- private final Map resourceBundleCaches;
+ private final Map<Long, ResourceBundleCache> resourceBundleCaches;
/**
@@ -54,7 +54,7 @@ public class ResourceBundleManager imple
{
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 @@ public class ResourceBundleManager imple
*
* @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 @@ public class ResourceBundleManager imple
synchronized ( resourceBundleCaches )
{
Long key = new Long( provider.getBundleId() );
- cache = ( ResourceBundleCache ) resourceBundleCaches.get( key );
+ cache = resourceBundleCaches.get( key );
if ( cache == null )
{
cache = new ResourceBundleCache( provider );
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java Sat Dec 17 18:11:16 2011
@@ -41,7 +41,7 @@ public class ConfigurationPrinterAdapter
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 @@ public class ConfigurationPrinterAdapter
CUSTOM_MODES.add( ConfigurationPrinter.MODE_ZIP );
}
+ @SuppressWarnings("deprecation")
public static ConfigurationPrinterAdapter createAdapter(
final Object service,
final ServiceReference ref)
@@ -258,7 +259,7 @@ public class ConfigurationPrinterAdapter
/**
* 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
{
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java Sat Dec 17 18:11:16 2011
@@ -42,6 +42,7 @@ import org.osgi.util.tracker.ServiceTrac
* 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 @@ public class ConfigurationRender extends
private int cfgPrinterTrackerCount;
- private ArrayList configurationPrinters;
+ private ArrayList<ConfigurationPrinterAdapter> configurationPrinters;
/** Default constructor */
public ConfigurationRender( final ResourceBundleManager resourceBundleManager )
@@ -156,12 +157,12 @@ public class ConfigurationRender extends
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 @@ public class ConfigurationRender extends
// 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 @@ public class ConfigurationRender extends
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 @@ public class ConfigurationRender extends
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 @@ public class ConfigurationRender extends
}
}
- private final synchronized List getConfigurationPrinters()
+ private final synchronized List<ConfigurationPrinterAdapter> getConfigurationPrinters()
{
if ( cfgPrinterTracker == null )
{
@@ -293,7 +293,7 @@ public class ConfigurationRender extends
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 @@ public class ConfigurationRender extends
}
}
}
- configurationPrinters = new ArrayList(cp.values());
+ configurationPrinters = new ArrayList<ConfigurationPrinterAdapter>(cp.values());
cfgPrinterTrackerCount = cfgPrinterTracker.getTrackingCount();
}
@@ -319,7 +319,7 @@ public class ConfigurationRender extends
}
- 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 @@ public class ConfigurationRender extends
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 @@ public class ConfigurationRender extends
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
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java Sat Dec 17 18:11:16 2011
@@ -51,6 +51,7 @@ import org.osgi.framework.Bundle;
*
* 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 @@ public final class LicenseServlet extend
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 @@ public final class LicenseServlet extend
}
}
- 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;
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java Sat Dec 17 18:11:16 2011
@@ -33,6 +33,7 @@ public class SystemPropertiesPrinter ext
private static final String TITLE = "System Properties";
+ @SuppressWarnings("unused")
private static final String LABEL = "_systemproperties";
@@ -45,13 +46,12 @@ public class SystemPropertiesPrinter ext
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
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java Sat Dec 17 18:11:16 2011
@@ -29,6 +29,7 @@ public class ThreadPrinter extends Abstr
private static final String TITLE = "Threads";
+ @SuppressWarnings("unused")
private static final String LABEL = "_threads";
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Base64.java Sat Dec 17 18:11:16 2011
@@ -1072,7 +1072,7 @@ public class Base64 {
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 @@ public class Base64 {
try {
return string.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
- throw new IllegalStateException("UTF-8", e);
+ throw new IllegalStateException("UTF-8");
}
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java Sat Dec 17 18:11:16 2011
@@ -44,7 +44,7 @@ class ConfigurationListener implements M
{
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 @@ class ConfigurationListener implements M
//---------- ManagedService
- public void updated( Dictionary config )
+ @SuppressWarnings("unchecked")
+ public void updated( @SuppressWarnings("rawtypes") Dictionary config )
{
osgiManager.updateConfiguration( config );
}
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java?rev=1215540&r1=1215539&r2=1215540&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener2.java Sat Dec 17 18:11:16 2011
@@ -42,7 +42,7 @@ class ConfigurationListener2 extends Con
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 @@ class ConfigurationListener2 extends Con
// there is no locale support here
return null;
}
-
+
static final String getString(ResourceBundle rb, String key, String def)
{
try
@@ -100,7 +100,7 @@ class ConfigurationListener2 extends Con
}
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 @@ class ConfigurationListener2 extends Con
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 @@ class ConfigurationListener2 extends Con
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 @@ class ConfigurationListener2 extends Con
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 @@ class ConfigurationListener2 extends Con
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 @@ class ConfigurationListener2 extends Con
xocd = new ObjectClassDefinition()
{
- private final AttributeDefinition[] attrs = ( AttributeDefinition[] ) adList
+ private final AttributeDefinition[] attrs = adList
.toArray( new AttributeDefinition[adList.size()] );