Skip to content

Commit

Permalink
[KOGITO-9614] Avoiding stack ooverflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Aug 1, 2023
1 parent b50e0ae commit 70d458f
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.io.IOException;
import java.io.Reader;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
Expand All @@ -28,7 +27,6 @@

import org.drools.codegen.common.GeneratedFile;
import org.drools.codegen.common.GeneratedFileType;
import org.eclipse.microprofile.config.ConfigProvider;
import org.kie.kogito.codegen.api.context.KogitoBuildContext;
import org.kie.kogito.internal.SupportedExtensions;
import org.kie.kogito.serverless.workflow.io.URIContentLoaderFactory;
Expand All @@ -45,8 +43,6 @@
import io.serverlessworkflow.api.Workflow;
import io.serverlessworkflow.api.functions.FunctionDefinition;

import static org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils.FAIL_ON_ERROR_PROPERTY;

public class WorkflowCodeGenUtils {

private static final Logger logger = LoggerFactory.getLogger(WorkflowCodeGenUtils.class);
Expand Down Expand Up @@ -96,12 +92,8 @@ private static Optional<Workflow> getWorkflow(Path path) {
try (Reader r = Files.newBufferedReader(p)) {
return Optional.of(ServerlessWorkflowUtils.getWorkflow(r, WorkflowFormat.fromFileName(p.getFileName())));
} catch (IOException ex) {
if (ConfigProvider.getConfig().getOptionalValue(FAIL_ON_ERROR_PROPERTY, Boolean.class).orElse(true)) {
throw new UncheckedIOException(ex);
} else {
logger.error("Error reading workflow file {}", p, ex);
return Optional.<Workflow> empty();
}
logger.info("Error reading workflow file {}. Ignoring exception {}", p, ex);
return Optional.<Workflow> empty();
}
});
}
Expand Down

0 comments on commit 70d458f

Please sign in to comment.