From d3de8d95facace01b83a4b9d7963e53d9cb6310f Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 30 May 2013 18:26:26 +0200 Subject: [PATCH] Fix ScanPerspectives when resource has a component key --- .../java/org/sonar/core/component/ScanPerspectives.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java b/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java index ad8e7b9886b..ada1e649958 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java @@ -28,7 +28,6 @@ import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.resources.Resource; import javax.annotation.CheckForNull; - import java.util.Map; public class ScanPerspectives implements ResourcePerspectives, BatchComponent { @@ -55,7 +54,10 @@ public class ScanPerspectives implements ResourcePerspectives, BatchComponent { @CheckForNull public

P as(Class

perspectiveClass, Resource resource) { - Resource indexedResource = resourceIndex.getResource(resource); + Resource indexedResource = resource; + if (resource.getEffectiveKey() == null) { + indexedResource = resourceIndex.getResource(resource); + } if (indexedResource != null) { return as(perspectiveClass, new ResourceComponent(indexedResource)); } -- 2.39.5