From b9e8d63c88af8f96d730071dc3ab46c250e3239c Mon Sep 17 00:00:00 2001 From: undx Date: Tue, 25 Jun 2024 13:14:05 +0200 Subject: [PATCH] fix(TCOMP-2710): fix sonar warnings --- .../sdk/component/runtime/di/schema/TaCoKitGuessSchema.java | 2 +- .../component/runtime/di/schema/TaCoKitGuessSchemaTest.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java b/component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java index 70162df1edc80..09b2480da8959 100644 --- a/component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java +++ b/component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java @@ -204,7 +204,7 @@ public void guessComponentSchema(final Schema incomingSchema, final String outgo } catch (Exception e) { final DiscoverSchemaException dse = transformException(e); // When a processor is the start of a studio job and dev explicitly set the handleError to Lifecycle exec - if (isStartOfJob && EXECUTE_LIFECYCLE.equals(dse.getPossibleHandleErrorWith())) { + if (isStartOfJob && EXECUTE_LIFECYCLE == dse.getPossibleHandleErrorWith()) { try { guessOutputComponentSchemaThroughResult(); } catch (Exception er) { diff --git a/component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java b/component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java index 1bf2418e12b0f..7fbbd0ced41c0 100644 --- a/component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java +++ b/component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java @@ -17,6 +17,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -504,12 +505,12 @@ void deserializeDiscoverSchemaException() throws Exception { final String serialized = "{\"localizedMessage\":\"Unknown error. Retry!\",\"message\":\"Unknown error. Retry!\",\"stackTrace\":[],\"suppressed\":[],\"possibleHandleErrorWith\":\"RETRY\"}"; DiscoverSchemaException e = jsonToException(flattened); - assertFalse("EXECUTE_MOCK_JOB".equals(e.getPossibleHandleErrorWith().name())); + assertNotEquals("EXECUTE_MOCK_JOB", e.getPossibleHandleErrorWith().name()); assertEquals("EXCEPTION", e.getPossibleHandleErrorWith().name()); assertEquals("Not allowed to execute the HTTP call to retrieve the schema.", e.getMessage()); // e = jsonToException(serialized); - assertFalse("EXCEPTION".equals(e.getPossibleHandleErrorWith())); + assertNotEquals("EXCEPTION", e.getPossibleHandleErrorWith()); assertEquals("RETRY", e.getPossibleHandleErrorWith().name()); assertEquals("Unknown error. Retry!", e.getMessage()); }