Skip to content

Commit

Permalink
fix(TCOMP-2710): fix sonar warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
undx committed Jun 25, 2024
1 parent ba2d0cd commit b9e8d63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {

Check warning on line 207 in component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java

View check run for this annotation

sonar-eks / Component Runtime Sonarqube Results

component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java#L207

Use the primitive boolean expression here.
try {
guessOutputComponentSchemaThroughResult();
} catch (Exception er) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Check failure on line 513 in component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java

View check run for this annotation

sonar-eks / Component Runtime Sonarqube Results

component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java#L513

Change the assertion arguments to not compare dissimilar types.
assertEquals("RETRY", e.getPossibleHandleErrorWith().name());
assertEquals("Unknown error. Retry!", e.getMessage());
}
Expand Down

0 comments on commit b9e8d63

Please sign in to comment.