From 3cba1e24c5d388080fc1efca1d68caa07feb6595 Mon Sep 17 00:00:00 2001 From: mirkosertic Date: Tue, 26 Jan 2016 21:03:38 +0100 Subject: [PATCH 1/2] Fix for #126 --- .../processor/sonar/SonarResultParser.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java b/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java index b6ddc17f..4bdb6f09 100644 --- a/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java +++ b/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java @@ -118,9 +118,20 @@ private String getIssueFilePath(String issueComponent, Map co Component comp = components.get(issueComponent); String file = comp.path; if (!Strings.isNullOrEmpty(comp.moduleKey)) { - Component moduleComp = components.get(comp.moduleKey); - if (!Strings.isNullOrEmpty(moduleComp.path)) { - file = moduleComp.path + '/' + file; + String theKey = comp.moduleKey; + while (!theKey.isEmpty()) { + Component theChildComp = components.get(theKey); + + int p = theKey.lastIndexOf(":"); + if (p>0) { + theKey = theKey.substring(0, p); + } else { + theKey = ""; + } + + if (theChildComp != null && !Strings.isNullOrEmpty(theChildComp.path)) { + file = theChildComp.path + '/' + file; + } } } return file; From 3a54cd9bcfea37dfee85f570e905834bb4ad5cf4 Mon Sep 17 00:00:00 2001 From: Mirko Sertic Date: Wed, 27 Jan 2016 11:28:43 +0100 Subject: [PATCH 2/2] Update SonarResultParser.java --- .../java/pl/touk/sputnik/processor/sonar/SonarResultParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java b/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java index 4bdb6f09..d5a56a1d 100644 --- a/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java +++ b/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java @@ -123,7 +123,7 @@ private String getIssueFilePath(String issueComponent, Map co Component theChildComp = components.get(theKey); int p = theKey.lastIndexOf(":"); - if (p>0) { + if (p > 0) { theKey = theKey.substring(0, p); } else { theKey = "";