-
Bug
-
Resolution: Done
-
Major
-
None
-
None
If a user service is declaring some checked exceptions, the resources that are code-generated do not include them. For example if the service isĀ
@ApplicationScoped public class OperatorSearchService { public static boolean isAvailable() throws JsonProcessingException, IOException { ObjectMapper objectMapper = new ObjectMapper(); //InputStream inputStream = OperatorSearchService.class.getClassLoader().getResourceAsStream("database.json"); String json = "{ \"operator\" : { \"isAvailable\" : true } }"; JsonNode jsonNode = objectMapper.readTree(json); JsonNode availableNode = jsonNode.at("/operator/isAvailable"); return availableNode.asBoolean(); } }
and a bpmn is using the `isAvailable` method, then the resource that is code-generated is
package org.kie.kogito.handlers; @javax.enterprise.context.ApplicationScoped() public class OperatorSearchService_isAvailableHandler implements org.kie.api.runtime.process.WorkItemHandler { @javax.inject.Inject() org.acme.OperatorSearchService service; public void executeWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager workItemManager) { java.lang.Object result = service.isAvailable(); workItemManager.completeWorkItem(workItem.getId(), java.util.Collections.singletonMap("Result", result)); } public void abortWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager workItemManager) { } public String getName() { return "org.acme.OperatorSearchService.isAvailable"; } }
Since the checked Exception is not declared, then a compilation error is raised as soon as `mvn clean compile quarkus:dev` is run.
See the reproducer hereĀ https://github.com/r00ta/kogito