This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.serviceusermapper-1.2.6 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 8a5761ad4313dfad754264552ff21550d74636d9 Author: Carsten Ziegeler <[email protected]> AuthorDate: Wed Dec 14 09:58:21 2016 +0000 SLING-6397 : Error logged by ServiceUserMapperImpl while unregistering an already unregistered service git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1774158 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/ServiceUserMapperImpl.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java index d4bc867..b2f980e 100644 --- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java +++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java @@ -151,10 +151,10 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { @Deactivate synchronized void deactivate() { - RegistrationSet registrationSet = null; + // this call does not unregister the mappings, but they should be unbound + // through the unbind methods anyway updateServiceRegistrations(new Mapping[0]); bundleContext = null; - this.executeServiceRegistrationsAsync(registrationSet); if (executorService != null) { executorService.shutdown(); executorService = null; @@ -305,13 +305,13 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { } - private void executeServiceRegistrations(RegistrationSet registrationSet) { + private void executeServiceRegistrations(final RegistrationSet registrationSet) { if (registrationSet == null) { return; } - for (Registration registration : registrationSet.removed) { + for (final Registration registration : registrationSet.removed) { ServiceRegistration serviceRegistration = registration.setService(null); @@ -320,8 +320,8 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { try { serviceRegistration.unregister(); log.debug("Unregistered ServiceUserMapped {}", registration.mapping); - } catch (IllegalStateException e) { - log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e); + } catch (final IllegalStateException e) { + // this can happen on shutdown, therefore we just ignore it and don't log } } } @@ -332,7 +332,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { return; } - for (Registration registration : registrationSet.added) { + for (final Registration registration : registrationSet.added) { Mapping mapping = registration.mapping; final Dictionary<String, Object> properties = new Hashtable<String, Object>(); if (mapping.getSubServiceName() != null) { @@ -349,8 +349,8 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { if (oldServiceRegistration != null) { try { oldServiceRegistration.unregister(); - } catch (IllegalStateException e) { - log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e); + } catch (final IllegalStateException e) { + // this can happen on shutdown, therefore we just ignore it and don't log } } } @@ -359,9 +359,9 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { private String internalGetUserId(final String serviceName, final String subServiceName) { log.debug( - "internalGetUserId: {} active mappings, looking for mapping for {}/{}", + "internalGetUserId: {} active mappings, looking for mapping for {}/{}", new Object[] { this.activeMappings.length, serviceName, subServiceName }); - + for (final Mapping mapping : this.activeMappings) { final String userId = mapping.map(serviceName, subServiceName); if (userId != null) { @@ -372,9 +372,9 @@ public class ServiceUserMapperImpl implements ServiceUserMapper { // second round without serviceInfo log.debug( - "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>", + "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>", this.activeMappings.length, serviceName); - + for (Mapping mapping : this.activeMappings) { final String userId = mapping.map(serviceName, null); if (userId != null) { -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
