]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.server.jcr/src/org/argeo/jcr/DefaultRepositoryRegister.java
Fix logging typo
[lgpl/argeo-commons.git] / org.argeo.server.jcr / src / org / argeo / jcr / DefaultRepositoryRegister.java
index f13c84e3b8b1ca8fb8d4e297c3467b5dd1362fa9..690bc3c9ceded0c9650e28437ca6fab2bff7dc80 100644 (file)
@@ -57,11 +57,10 @@ public class DefaultRepositoryRegister extends Observable implements
        /** Registers a service, typically called when OSGi services are bound. */
        @SuppressWarnings("rawtypes")
        public synchronized void register(Repository repository, Map properties) {
-               // TODO: also check bean name?
                String alias;
                if (properties == null || !properties.containsKey(JCR_REPOSITORY_ALIAS)) {
                        log.warn("Cannot register a repository if no "
-                                       + JCR_REPOSITORY_ALIAS + " property is speecified.");
+                                       + JCR_REPOSITORY_ALIAS + " property is specified.");
                        return;
                }
                alias = properties.get(JCR_REPOSITORY_ALIAS).toString();
@@ -86,7 +85,10 @@ public class DefaultRepositoryRegister extends Observable implements
                String alias = properties.get(JCR_REPOSITORY_ALIAS).toString();
                Map<String, Repository> map = new TreeMap<String, Repository>(
                                repositories);
-               map.put(alias, repository);
+               if (map.remove(alias) == null) {
+                       log.warn("No repository was registered with alias " + alias);
+                       return;
+               }
                repositories = Collections.unmodifiableMap(map);
                setChanged();
                notifyObservers(alias);