From e51e80cfb3364632d1b4818629a0285039889053 Mon Sep 17 00:00:00 2001 From: Sandro Heinzelmann Date: Thu, 20 Feb 2020 12:40:52 +0100 Subject: [PATCH] fixup! Fix Sonar analysis bug issue (#56) Use SuppressWarnings instead of NOSONAR --- .../org/sonar/plugins/buildbreaker/QualityGateBreaker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sonar/plugins/buildbreaker/QualityGateBreaker.java b/src/main/java/org/sonar/plugins/buildbreaker/QualityGateBreaker.java index ca6d838..cf35fa5 100644 --- a/src/main/java/org/sonar/plugins/buildbreaker/QualityGateBreaker.java +++ b/src/main/java/org/sonar/plugins/buildbreaker/QualityGateBreaker.java @@ -175,6 +175,8 @@ private File getReportTaskFile() { } @VisibleForTesting + // We have to treat a premature interrupt as a failure since we couldn't retrieve the analysis id. + @SuppressWarnings("squid:S2142") String getAnalysisId(WsClient wsClient, String ceTaskId) { WsRequest ceTaskRequest = new GetRequest("api/ce/task").setParam("id", ceTaskId).setMediaType(MediaTypes.PROTOBUF); @@ -203,8 +205,7 @@ String getAnalysisId(WsClient wsClient, String ceTaskId) { throw new IllegalStateException( "Report processing did not complete successfully: " + taskStatus); } - } catch (IOException | InterruptedException e) { // NOSONAR: We have to treat a premature - // interrupt as a failure since we couldn't retrieve the analysis id (java:S2142) + } catch (IOException | InterruptedException e) { throw new IllegalStateException(e.getMessage(), e); } }