[
https://issues.apache.org/jira/browse/SLING-7198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Karl Pauls updated SLING-7198:
------------------------------
Fix Version/s: Service User Mapper 1.3.6
> Duplicated lookup for mapping without subserviceName
> ----------------------------------------------------
>
> Key: SLING-7198
> URL: https://issues.apache.org/jira/browse/SLING-7198
> Project: Sling
> Issue Type: Bug
> Components: Service User Mapper
> Affects Versions: Service User Mapper 1.3.4
> Reporter: angela
> Priority: Minor
> Fix For: Service User Mapper 1.3.6
>
>
> [~kpauls] If I am not mistaken there is an extra lookup in the following
> method:
> {code}
> private Iterable<String> internalGetPrincipalNames(final String
> serviceName, final String subServiceName) {
> log.debug(
> "internalGetPrincipalNames: {} active mappings, looking for
> mapping for {}/{}",
> new Object[] { this.activeMappings.length, serviceName,
> subServiceName });
> for (final Mapping mapping : this.activeMappings) {
> final Iterable<String> principalNames =
> mapping.mapPrincipals(serviceName, subServiceName);
> if (principalNames != null) {
> log.debug("Got principalNames [{}] from {}/{}", new Object[]
> {principalNames, serviceName, subServiceName });
> return principalNames;
> }
> }
> for (Mapping mapping : this.activeMappings) {
> final Iterable<String> principalNames =
> mapping.mapPrincipals(serviceName, null);
> if (principalNames != null) {
> log.debug("Got principalNames [{}] from {}/{}", new Object[]
> {principalNames, serviceName });
> return principalNames;
> }
> }
> // second round without serviceInfo
> log.debug(
> "internalGetPrincipalNames: {} active mappings, looking for
> mapping for {}/<no subServiceName>",
> this.activeMappings.length, serviceName);
> for (Mapping mapping : this.activeMappings) {
> final Iterable<String> principalNames =
> mapping.mapPrincipals(serviceName, null);
> if (principalNames != null) {
> log.debug("Got principalNames [{}] from {}/<no
> subServiceName>", principalNames, serviceName);
> return principalNames;
> }
> }
> log.debug("internalGetPrincipalNames: no mapping found.");
> return null;
> }
> {code}
> If I read the code properly the lookup that is logged by being the 'second
> round' is actually the third perform once again the lookup without
> 'subServiceName'. If that is correct I would suggest to remove the following
> code:
> {code}
> for (Mapping mapping : this.activeMappings) {
> final Iterable<String> principalNames =
> mapping.mapPrincipals(serviceName, null);
> if (principalNames != null) {
> log.debug("Got principalNames [{}] from {}/{}", new Object[]
> {principalNames, serviceName });
> return principalNames;
> }
> }
> {code}
> or the third one that is called the second round ;-)
> But please double check to make sure I didn't just overlook some subtle diff
> :-)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)