Skip to content

Commit

Permalink
Merge pull request #204 from sentrysoftware/124-incorrect-connectors-…
Browse files Browse the repository at this point in the history
…shouldnt-lead-to-an-engine-failure

Issue #124: Invalid connector no longer results in an empty Connector…
  • Loading branch information
NassimBtk committed May 28, 2024
2 parents e6009b5 + 14a8a65 commit 3cb611c
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
@Slf4j
public class ConnectorLibraryParser {

public static final String CONNECTOR_PARSING_ERROR = "Error while parsing connector {}: {}";

/**
* The ObjectMapper instance for handling YAML files.
*/
Expand Down Expand Up @@ -82,8 +84,13 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
}
final ConnectorParser connectorParser = ConnectorParser.withNodeProcessorAndUpdateChain(file.getParent());

final Connector connector = connectorParser.parse(file.toFile());
connectorsMap.put(filename.substring(0, filename.lastIndexOf('.')), connector);
try {
final Connector connector = connectorParser.parse(file.toFile());
connectorsMap.put(filename.substring(0, filename.lastIndexOf('.')), connector);
} catch (Exception e) {
log.error(CONNECTOR_PARSING_ERROR, filename, e.getMessage());
log.debug("Exception: ", e);
}

return FileVisitResult.CONTINUE;
}
Expand Down Expand Up @@ -127,10 +134,11 @@ public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IO
final Connector connector;
try {
connector = connectorParser.parse(Files.newInputStream(path), connectorFolderUri, fileName);
} catch (IOException e) {
throw new IllegalStateException(e);
connectorsMap.put(fileName.substring(0, fileName.lastIndexOf('.')), connector);
} catch (Exception e) {
log.error(CONNECTOR_PARSING_ERROR, fileName, e.getMessage());
log.debug("Exception: ", e);
}
connectorsMap.put(fileName.substring(0, fileName.lastIndexOf('.')), connector);
}
);

Expand Down

0 comments on commit 3cb611c

Please sign in to comment.