From 44ba812d506ed77fd1709f9e845d9aaae6235b86 Mon Sep 17 00:00:00 2001 From: Christian Burne Date: Sat, 5 Mar 2022 09:22:37 -0800 Subject: [PATCH] updated getSonarProjectFromBuildReport to handle analysis URL that is provided by sonarqube 9.3 which includes /dashboard?id=.." in the URL --- .../plugins/influxdb/generators/SonarQubePointGenerator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java b/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java index fc6d1182..c53a5591 100644 --- a/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java +++ b/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java @@ -302,6 +302,10 @@ private String[] getSonarProjectFromBuildLog(Run build) throws IOException match = p_analysis_url.matcher(line); if (match.matches()) { url = match.group(1); + long count = url.chars().filter(ch -> ch == '/').count(); + if (count >=3) { + url = url.substring(0,url.lastIndexOf(('/'))); + } continue; } match = p_taskUrl.matcher(line);