Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=552440

Change-Id: Ibaed2167dc1105e5a8b1b55f9052bbaaf2b6b221
diff --git a/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF b/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF
index 4a9cfdf..997b1bd 100644
--- a/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF
+++ b/protocols/bundles/ch.ethz.iks.slp/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-Name: Service Location Protocol (RFC 2608) Implementation
 Bundle-SymbolicName: ch.ethz.iks.slp
 Automatic-Module-Name: ch.ethz.iks.slp
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.1.qualifier
 Export-Package: ch.ethz.iks.slp;version="1.0.0"
 Bundle-Activator: ch.ethz.iks.slp.impl.Activator
 Bundle-Vendor: Eclipse.org - ECF
diff --git a/protocols/bundles/ch.ethz.iks.slp/pom.xml b/protocols/bundles/ch.ethz.iks.slp/pom.xml
index 0032600..ead530f 100644
--- a/protocols/bundles/ch.ethz.iks.slp/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.slp/pom.xml
@@ -10,6 +10,6 @@
   </parent>
   <groupId>org.eclipse.ecf</groupId>
   <artifactId>ch.ethz.iks.slp</artifactId>
-  <version>1.2.0-SNAPSHOT</version>
+  <version>1.2.1-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/Activator.java b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/Activator.java
index d85b755..ac299e1 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/Activator.java
+++ b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/Activator.java
@@ -27,33 +27,41 @@
  */
 public class Activator implements BundleActivator {
 
+	private static final boolean ENABLE_JSLP = Boolean
+			.valueOf(System.getProperty("ch.ethz.iks.slp.enable", "false"));
+
 	/**
 	 * 
 	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 	 */
 	public void start(final BundleContext context) throws Exception {
 
-		// create the platform abstraction layer but do not initialize!!!
-		SLPCore.platform = new OSGiPlatformAbstraction(context);
+		if (ENABLE_JSLP) {
+			// create the platform abstraction layer but do not initialize!!!
+			SLPCore.platform = new OSGiPlatformAbstraction(context);
 
-		// register the service factories so each consumer gets its own Locator/Activator instance
-		context.registerService("ch.ethz.iks.slp.Advertiser", new ServiceFactory() {
-			public Object getService(Bundle bundle, ServiceRegistration registration) {
-				SLPCore.init();
-				SLPCore.initMulticastSocket();
-				return new AdvertiserImpl();
-			}
-			public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
-			}
-		}, null);
-		context.registerService("ch.ethz.iks.slp.Locator", new ServiceFactory() {
-			public Object getService(Bundle bundle, ServiceRegistration registration) {
-				SLPCore.init();
-				return new LocatorImpl();
-			}
-			public void ungetService(Bundle bundle,	ServiceRegistration registration, Object service) {
-			}
-		}, null);
+			// register the service factories so each consumer gets its own
+			// Locator/Activator instance
+			context.registerService("ch.ethz.iks.slp.Advertiser", new ServiceFactory() {
+				public Object getService(Bundle bundle, ServiceRegistration registration) {
+					SLPCore.init();
+					SLPCore.initMulticastSocket();
+					return new AdvertiserImpl();
+				}
+
+				public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+				}
+			}, null);
+			context.registerService("ch.ethz.iks.slp.Locator", new ServiceFactory() {
+				public Object getService(Bundle bundle, ServiceRegistration registration) {
+					SLPCore.init();
+					return new LocatorImpl();
+				}
+
+				public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+				}
+			}, null);
+		}
 	}
 
 	/**
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java
index a33c136..fe89ad8 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java
+++ b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java
@@ -233,7 +233,7 @@
 				for (int i = 0; i < addresses.length; i++) {
 					// https://bugs.eclipse.org/328074
 					if(addresses[i] instanceof Inet6Address) {
-						System.err.println("No support for IPv6 in jSLP yet (see https://bugs.eclipse.org/328074), skipping interface...");
+						platform.logWarning("No support for IPv6 in jSLP yet (see https://bugs.eclipse.org/328074), skipping interface...");
 						continue;
 					}
 					ips.add(addresses[i].getHostAddress());
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/.classpath b/providers/bundles/org.eclipse.ecf.provider.jslp/.classpath
index 6f3b481..eca7bdb 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/.classpath
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="output" path="bin"/>
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/.settings/org.eclipse.jdt.core.prefs b/providers/bundles/org.eclipse.ecf.provider.jslp/.settings/org.eclipse.jdt.core.prefs
index 7c76c74..72ea108 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/.settings/org.eclipse.jdt.core.prefs
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/.settings/org.eclipse.jdt.core.prefs
@@ -7,9 +7,9 @@
 org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
 org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.8
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -91,23 +91,27 @@
 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
@@ -177,11 +181,12 @@
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
 org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -211,6 +216,8 @@
 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
 org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -234,12 +241,16 @@
 org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
 org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -285,6 +296,8 @@
 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -320,8 +333,11 @@
 org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
 org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -344,6 +360,10 @@
 org.eclipse.jdt.core.formatter.tabulation.char=tab
 org.eclipse.jdt.core.formatter.tabulation.size=4
 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
 org.eclipse.jdt.core.incompatibleJDKLevel=ignore
 org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF
index 9cb1de1..a6359c2 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.ecf.provider.jslp;singleton:=true
 Automatic-Module-Name: org.eclipse.ecf.provider.jslp
-Bundle-Version: 3.2.201.qualifier
+Bundle-Version: 3.3.0.qualifier
 Bundle-Activator: org.eclipse.ecf.internal.provider.jslp.Activator
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
@@ -16,8 +16,7 @@
  org.eclipse.equinox.common,
  org.eclipse.ecf.identity;bundle-version="2.1.0",
  org.eclipse.ecf;bundle-version="2.0.0"
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ClassPath: .
 Export-Package: org.eclipse.ecf.internal.provider.jslp;x-friends:="org.eclipse.ecf.tests.provider.jslp",
  org.eclipse.ecf.provider.jslp.container;version="3.0.0",
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/pom.xml b/providers/bundles/org.eclipse.ecf.provider.jslp/pom.xml
index eca569f..3f6ab01 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/pom.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/pom.xml
@@ -10,6 +10,6 @@
   </parent>
   <groupId>org.eclipse.ecf</groupId>
   <artifactId>org.eclipse.ecf.provider.jslp</artifactId>
-  <version>3.2.201-SNAPSHOT</version>
+  <version>3.3.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java
index 49917c7..054a73b 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java
@@ -12,7 +12,7 @@
 
 import ch.ethz.iks.slp.Advertiser;
 import ch.ethz.iks.slp.Locator;
-import java.util.Properties;
+import java.util.Hashtable;
 import org.eclipse.core.runtime.SafeRunner;
 import org.eclipse.ecf.core.*;
 import org.eclipse.ecf.core.identity.Namespace;
@@ -45,9 +45,9 @@
 	// @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=108214
 	private volatile BundleContext bundleContext;
 
-	private volatile ServiceTracker locatorSt;
-	private volatile ServiceTracker advertiserSt;
-	private volatile ServiceRegistration serviceRegistration;
+	private volatile ServiceTracker<Locator, Locator> locatorSt;
+	private volatile ServiceTracker<Advertiser, Advertiser> advertiserSt;
+	private volatile ServiceRegistration<?> serviceRegistration;
 
 	/**
 	 * The constructor
@@ -62,7 +62,7 @@
 
 	public LocatorDecorator getLocator() {
 		locatorSt.open();
-		final Locator aLocator = (Locator) locatorSt.getService();
+		final Locator aLocator = locatorSt.getService();
 		if (aLocator == null) {
 			return new NullPatternLocator();
 		}
@@ -71,43 +71,47 @@
 
 	public Advertiser getAdvertiser() {
 		advertiserSt.open();
-		final Advertiser advertiser = (Advertiser) advertiserSt.getService();
+		final Advertiser advertiser = advertiserSt.getService();
 		if (advertiser == null) {
 			return new NullPatternAdvertiser();
 		}
 		return advertiser;
 	}
 
+	private static final boolean ENABLE_JSLP = Boolean.valueOf(System.getProperty("ch.ethz.iks.slp.enable", "false")); //$NON-NLS-1$ //$NON-NLS-2$
+
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
 	 */
 	public void start(final BundleContext context) throws Exception {
-		bundleContext = context;
+		if (ENABLE_JSLP) {
+			bundleContext = context;
 
-		SafeRunner.run(new ExtensionRegistryRunnable(context) {
-			protected void runWithoutRegistry() throws Exception {
-				context.registerService(Namespace.class, new JSLPNamespace(), null);
-				context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp", new ContainerInstantiator(), "JSLP Discovery Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
-				context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.locator", new ContainerInstantiator(), "JSLP Discovery Locator Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
-				context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.advertiser", new ContainerInstantiator(), "JSLP Discovery Advertiser Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
-			}
-		});
+			SafeRunner.run(new ExtensionRegistryRunnable(context) {
+				protected void runWithoutRegistry() throws Exception {
+					context.registerService(Namespace.class, new JSLPNamespace(), null);
+					context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp", new ContainerInstantiator(), "JSLP Discovery Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
+					context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.locator", new ContainerInstantiator(), "JSLP Discovery Locator Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
+					context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.advertiser", new ContainerInstantiator(), "JSLP Discovery Advertiser Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
+				}
+			});
 
-		// initially get the locator and add a life cycle listener
-		locatorSt = new ServiceTracker(context, Locator.class.getName(), null);
+			// initially get the locator and add a life cycle listener
+			locatorSt = new ServiceTracker<Locator, Locator>(context, Locator.class.getName(), null);
 
-		// initially get the advertiser and add a life cycle listener
-		advertiserSt = new ServiceTracker(context, Advertiser.class.getName(), null);
+			// initially get the advertiser and add a life cycle listener
+			advertiserSt = new ServiceTracker<Advertiser, Advertiser>(context, Advertiser.class.getName(), null);
 
-		// register ourself as an OSGi service
-		final Properties props = new Properties();
-		props.put(IDiscoveryService.CONTAINER_NAME, JSLPDiscoveryContainer.NAME);
-		props.put(Constants.SERVICE_RANKING, new Integer(500));
+			// register ourself as an OSGi service
+			final Hashtable<String, Object> props = new Hashtable<String, Object>();
+			props.put(IDiscoveryService.CONTAINER_NAME, JSLPDiscoveryContainer.NAME);
+			props.put(Constants.SERVICE_RANKING, new Integer(500));
 
-		String[] clazzes = new String[] {IDiscoveryService.class.getName(), IDiscoveryLocator.class.getName(), IDiscoveryAdvertiser.class.getName()};
-		serviceRegistration = context.registerService(clazzes, serviceFactory, props);
+			String[] clazzes = new String[] {IDiscoveryService.class.getName(), IDiscoveryLocator.class.getName(), IDiscoveryAdvertiser.class.getName()};
+			serviceRegistration = context.registerService(clazzes, serviceFactory, props);
+		}
 	}
 
 	private final DiscoveryServiceFactory serviceFactory = new DiscoveryServiceFactory();
@@ -155,12 +159,12 @@
 	public void stop(final BundleContext context) throws Exception {
 		//TODO-mkuppe here we should do something like a deregisterAll(), but see ungetService(...);
 		if (serviceRegistration != null && serviceFactory.isActive()) {
-			ServiceReference reference = serviceRegistration.getReference();
+			ServiceReference<?> reference = serviceRegistration.getReference();
 			IDiscoveryLocator aLocator = (IDiscoveryLocator) context.getService(reference);
 
 			serviceRegistration.unregister();
 
-			IContainer container = (IContainer) aLocator.getAdapter(IContainer.class);
+			IContainer container = aLocator.getAdapter(IContainer.class);
 			container.disconnect();
 			container.dispose();