FELIX-3998 Updating JAAS config leads to registration of duplicate LoginModules

Tracker should be opened last

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1505897 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jaas/src/main/java/org/apache/felix/jaas/internal/ConfigSpiOsgi.java b/jaas/src/main/java/org/apache/felix/jaas/internal/ConfigSpiOsgi.java
index adb92b3..877e793 100644
--- a/jaas/src/main/java/org/apache/felix/jaas/internal/ConfigSpiOsgi.java
+++ b/jaas/src/main/java/org/apache/felix/jaas/internal/ConfigSpiOsgi.java
@@ -19,29 +19,6 @@
 
 package org.apache.felix.jaas.internal;
 
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.ConfigurationSpi;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
 import org.apache.felix.jaas.LoginContextFactory;
 import org.apache.felix.jaas.LoginModuleFactory;
 import org.apache.felix.jaas.boot.ProxyLoginModule;
@@ -60,6 +37,16 @@
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.*;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
 @Component(label = "%jaas.spi.name",
         description = "%jaas.spi.description",
         metatype = true,
@@ -245,8 +232,8 @@
 
     void open()
     {
-        this.tracker.open();
         this.configs = Collections.emptyMap();
+        this.tracker.open();
     }
 
     void close()