From 7661fc25290888cae28c49c576f9f2029a354382 Mon Sep 17 00:00:00 2001 From: Rishi Kunnath <82925475+rishikunnath2747@users.noreply.github.com> Date: Fri, 28 Mar 2025 10:38:14 +0530 Subject: [PATCH] sonar fixes --- .github/workflows/sonarqube.yml | 2 +- sdm/src/main/java/com/sap/cds/sdm/constants/SDMConstants.java | 2 +- sdm/src/main/java/com/sap/cds/sdm/handler/TokenHandler.java | 2 +- .../main/java/com/sap/cds/sdm/service/SDMAdminServiceImpl.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 6cad0df0..41045402 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -70,7 +70,7 @@ jobs: -Dsonar.junit.reportPaths=sdm/target/surefire-reports \ -Dsonar.coverage.jacoco.xmlReportPaths=sdm/target/site/jacoco/jacoco.xml \ -Dsonar.inclusions=**/*.java \ - -Dsonar.exclusions=**/target/**,**/node_modules/**,sdm/src/main/test/**,cap-notebook/*.capnb,sdm/src/main/java/com/sap/cds/sdm/model/**,sdm/src/main/java/com/sap/cds/sdm/caching/CacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/RepoKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/TokenCacheKey.java \ + -Dsonar.exclusions=**/target/**,**/node_modules/**,sdm/src/main/test/**,cap-notebook/*.capnb,sdm/src/main/java/com/sap/cds/sdm/model/**,sdm/src/main/java/com/sap/cds/sdm/caching/CacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/RepoKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/TokenCacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/SecondaryTypesKey.java \ -Dsonar.java.file.suffixes=.java \ -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} diff --git a/sdm/src/main/java/com/sap/cds/sdm/constants/SDMConstants.java b/sdm/src/main/java/com/sap/cds/sdm/constants/SDMConstants.java index 39ba4a64..0549a5ec 100644 --- a/sdm/src/main/java/com/sap/cds/sdm/constants/SDMConstants.java +++ b/sdm/src/main/java/com/sap/cds/sdm/constants/SDMConstants.java @@ -41,7 +41,7 @@ private SDMConstants() { public static final int CONNECTION_TIMEOUT = 1200; public static final String ONBOARD_REPO_MESSAGE = "Repository with name %s and id %s onboarded successfully"; - public static final String ONBOARD_REPO__ERROR_MESSAGE = + public static final String ONBOARD_REPO_ERROR_MESSAGE = "Error in onboarding repository with name %s"; public static final String UPDATE_ATTACHMENT_ERROR = "Could not update the attachment"; diff --git a/sdm/src/main/java/com/sap/cds/sdm/handler/TokenHandler.java b/sdm/src/main/java/com/sap/cds/sdm/handler/TokenHandler.java index 4591d58f..1f947e47 100644 --- a/sdm/src/main/java/com/sap/cds/sdm/handler/TokenHandler.java +++ b/sdm/src/main/java/com/sap/cds/sdm/handler/TokenHandler.java @@ -189,7 +189,7 @@ public static HttpClient getHttpClient( DefaultHttpClientFactory.DefaultHttpClientFactoryBuilder builder = DefaultHttpClientFactory.builder(); if (connectionPoolConfig == null) { - Duration timeout = Duration.ofSeconds((long) SDMConstants.CONNECTION_TIMEOUT); + Duration timeout = Duration.ofSeconds(SDMConstants.CONNECTION_TIMEOUT); builder.timeoutMilliseconds((int) timeout.toMillis()); builder.maxConnectionsPerRoute(SDMConstants.MAX_CONNECTIONS); builder.maxConnectionsTotal(SDMConstants.MAX_CONNECTIONS); diff --git a/sdm/src/main/java/com/sap/cds/sdm/service/SDMAdminServiceImpl.java b/sdm/src/main/java/com/sap/cds/sdm/service/SDMAdminServiceImpl.java index 5c1a6142..1bc14634 100644 --- a/sdm/src/main/java/com/sap/cds/sdm/service/SDMAdminServiceImpl.java +++ b/sdm/src/main/java/com/sap/cds/sdm/service/SDMAdminServiceImpl.java @@ -43,7 +43,7 @@ public String onboardRepository(Repository repository) SDMConstants.ONBOARD_REPO_MESSAGE, repository.getDisplayName(), repositoryId); } catch (IOException e) { throw new ServiceException( - String.format(SDMConstants.ONBOARD_REPO__ERROR_MESSAGE, repository.getDisplayName()), + String.format(SDMConstants.ONBOARD_REPO_ERROR_MESSAGE, repository.getDisplayName()), e.getMessage()); } }