]
Jan Hrcek reassigned DROOLS-2166:
---------------------------------
Assignee: Mario Fusco (was: Eder Ignatowicz)
NPE in KieModuleMetaDataImpl in projects with invalid pom.xml
-------------------------------------------------------------
Key: DROOLS-2166
URL:
https://issues.jboss.org/browse/DROOLS-2166
Project: Drools
Issue Type: Bug
Reporter: Jan Hrcek
Assignee: Mario Fusco
When indexing assets in projects which have some problems with pom.xml (e.g. the parent
of that pom can't be resolved), there's the following exception in server.log
{code:java}
14:34:46,627 ERROR [stderr] (Thread-144) java.lang.NullPointerException
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.scanner.KieModuleMetaDataImpl.init(KieModuleMetaDataImpl.java:167)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.scanner.KieModuleMetaDataImpl.<init>(KieModuleMetaDataImpl.java:86)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.scanner.KieModuleMetaData$Factory.newKieModuleMetaData(KieModuleMetaData.java:60)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.backend.builder.core.Builder.getKieModuleMetaDataIgnoringErrors(Builder.java:593)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.backend.builder.service.BuildInfoImpl.getKieModuleMetaDataIgnoringErrors(BuildInfoImpl.java:46)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.datamodel.backend.server.cache.ProjectDataModelOracleBuilderProvider.newBuilder(ProjectDataModelOracleBuilderProvider.java:62)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.datamodel.backend.server.cache.LRUProjectDataModelOracleCache.makeProjectOracle(LRUProjectDataModelOracleCache.java:80)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.datamodel.backend.server.cache.LRUProjectDataModelOracleCache.assertProjectDataModelOracle(LRUProjectDataModelOracleCache.java:72)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.datamodel.backend.server.cache.LRUProjectDataModelOracleCache$Proxy$_$$_WeldClientProxy.assertProjectDataModelOracle(Unknown
Source)
14:34:46,627 ERROR [stderr] (Thread-144) at
org.kie.workbench.common.services.datamodel.backend.server.DataModelServiceImpl.getProjectDataModel(DataModelServiceImpl.java:91)
{code}
The root cause is that kieModule.getPomModel()
[
here|https://github.com/kiegroup/drools/blob/master/kie-ci/src/main/java/...]
returns null, because pom model is [not created in this
case|https://github.com/kiegroup/drools/blob/master/drools-compiler/src/m...]
because it can't be parsed or can't be validated.
In this case we should at least avoid many NPEs being shown in server.log by doing null
check and doing nothing if getPomModel() returns null