This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 8f7067b1eb7 (chores) camel-google-secret-manager: fixing a few code
violations from SonarCloud (#8552)
8f7067b1eb7 is described below
commit 8f7067b1eb73d45f4f848cd9150625d5dbd493c7
Author: Gilvan Filho <[email protected]>
AuthorDate: Sat Oct 15 04:56:10 2022 -0300
(chores) camel-google-secret-manager: fixing a few code violations from
SonarCloud (#8552)
* (chores) camel-google-secret-manager: fixing a few code violations from
SonarCloud
Fixed:
- shadowing member variables
- removing unused imports and fields
* (chores) camel-google-secret-manager: fixing a few code violations from
SonarCloud
Fixed:
- removing unused local variables
---
.../google/secret/manager/GoogleSecretManagerComponent.java | 6 +++---
.../google/secret/manager/GoogleSecretManagerProducer.java | 3 ---
.../integration/GoogleSecretManagerPropertiesNoEnvSourceTestIT.java | 4 ++--
.../integration/GoogleSecretManagerPropertiesSourceTestIT.java | 4 ++--
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git
a/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
b/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
index 52b5f67e27d..3485c378e3c 100644
---
a/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
+++
b/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
@@ -41,11 +41,11 @@ public class GoogleSecretManagerComponent extends
DefaultComponent {
if (remaining == null || remaining.trim().length() == 0) {
throw new IllegalArgumentException("Project id must be
specified.");
}
- final GoogleSecretManagerConfiguration configuration
+ final GoogleSecretManagerConfiguration endpointConfiguration
= this.configuration != null ? this.configuration.copy() : new
GoogleSecretManagerConfiguration();
- configuration.setProject(remaining);
+ endpointConfiguration.setProject(remaining);
- Endpoint endpoint = new GoogleSecretManagerEndpoint(uri, this,
configuration);
+ Endpoint endpoint = new GoogleSecretManagerEndpoint(uri, this,
endpointConfiguration);
setProperties(endpoint, parameters);
return endpoint;
}
diff --git
a/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
b/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
index f0d00d05b2d..ffbd80820e5 100644
---
a/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
+++
b/components/camel-google/camel-google-secret-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
@@ -34,14 +34,11 @@ import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.Message;
import org.apache.camel.support.DefaultProducer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* The Google Secret Manager producer.
*/
public class GoogleSecretManagerProducer extends DefaultProducer {
- private static final Logger LOG =
LoggerFactory.getLogger(GoogleSecretManagerProducer.class);
private GoogleSecretManagerEndpoint endpoint;
diff --git
a/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesNoEnvSourceTestIT.java
b/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesNoEnvSourceTestIT.java
index fa205682c27..b56f7f34889 100644
---
a/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesNoEnvSourceTestIT.java
+++
b/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesNoEnvSourceTestIT.java
@@ -98,7 +98,7 @@ public class GoogleSecretManagerPropertiesNoEnvSourceTestIT
extends CamelTestSup
public void testSecretNotFoundFunction() {
context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
- Exception exception = assertThrows(FailedToCreateRouteException.class,
() -> {
+ assertThrows(FailedToCreateRouteException.class, () -> {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
@@ -159,7 +159,7 @@ public class GoogleSecretManagerPropertiesNoEnvSourceTestIT
extends CamelTestSup
public void testComplexCustomPropertiesExceptionFunction() {
context.getVaultConfiguration().gcp().setServiceAccountKey(System.getProperty("camel.vault.gcp.serviceAccountKey"));
context.getVaultConfiguration().gcp().setProjectId(System.getProperty("camel.vault.gcp.projectId"));
- Exception exception = assertThrows(FailedToCreateRouteException.class,
() -> {
+ assertThrows(FailedToCreateRouteException.class, () -> {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
diff --git
a/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesSourceTestIT.java
b/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesSourceTestIT.java
index fc894b123db..25d46296faf 100644
---
a/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesSourceTestIT.java
+++
b/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerPropertiesSourceTestIT.java
@@ -90,7 +90,7 @@ public class GoogleSecretManagerPropertiesSourceTestIT
extends CamelTestSupport
@EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_GCP_PROJECT_ID",
matches = ".*")
@Test
public void testSecretNotFoundFunction() {
- Exception exception = assertThrows(FailedToCreateRouteException.class,
() -> {
+ assertThrows(FailedToCreateRouteException.class, () -> {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
@@ -151,7 +151,7 @@ public class GoogleSecretManagerPropertiesSourceTestIT
extends CamelTestSupport
@EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_GCP_PROJECT_ID",
matches = ".*")
@Test
public void testComplexCustomPropertiesExceptionFunction() {
- Exception exception = assertThrows(FailedToCreateRouteException.class,
() -> {
+ assertThrows(FailedToCreateRouteException.class, () -> {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {