[jboss-jira] [JBoss JIRA] (DROOLS-5522) Fix InternalKieModule.createKieModule
Gabriele Cardosi (Jira)
issues at jboss.org
Wed Jul 22 08:52:28 EDT 2020
[ https://issues.redhat.com/browse/DROOLS-5522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gabriele Cardosi updated DROOLS-5522:
-------------------------------------
Description:
{code:java}
org.drools.compiler.kie.builder.impl.InternalKieModule.createKieModule(ReleaseId releaseId, File jar)
{code}
has a couple of issues
1) there is not a check on the actual type of File received as parameter: it expects it to be a "jar" - but this is not checked anywhere - so
{code:java}
ZipFile zipFile = new ZipFile(jar)
{code}
throws an exception whenever the given file is not a "jar"
2) every exceptions are catch and simply logged; but it seems that whatever exception may happen inside this if
{code:java}
if (zipEntry != null) {
KieModuleModel kieModuleModel = KieModuleModelImpl.fromXML( zipFile.getInputStream( zipEntry ) );
setDefaultsforEmptyKieModule( kieModuleModel );
return kieModuleModel != null ? InternalKieModuleProvider.get( adapt( releaseId ), kieModuleModel, jar ) : null;
}
{code}
it is actually a grave exception, since it means that it was impossible to retrieve an expected KieModule out of a given "kjar" (we know it is a kjar because zipEntry != null)
was:
{code:java}
org.drools.compiler.kie.builder.impl.InternalKieModule.createKieModule(ReleaseId releaseId, File jar)
{code}
has a couple of issues
1) there is not a check on the actual type of File received as parameter: it expects it to be a "jar" - but this is not checked anywhere - so
{code:java}
ZipFile zipFile = new ZipFile(jar)
{code}
throws an exception whenever the given file is not a "jar"
2) every exceptions are catch and simply logged; but it seems that whatever exception may happen inside this if
{code:java}
if (zipEntry != null) {
KieModuleModel kieModuleModel = KieModuleModelImpl.fromXML( zipFile.getInputStream( zipEntry ) );
setDefaultsforEmptyKieModule( kieModuleModel );
return kieModuleModel != null ? InternalKieModuleProvider.get( adapt( releaseId ), kieModuleModel, jar ) : null;
}
{code}
it is actually a grave exception, since it means that it was impossible to retrieve an expected KieModule out of a given "kjar" (we know if is a kjar because zipEntry != null)
> Fix InternalKieModule.createKieModule
> -------------------------------------
>
> Key: DROOLS-5522
> URL: https://issues.redhat.com/browse/DROOLS-5522
> Project: Drools
> Issue Type: Task
> Reporter: Gabriele Cardosi
> Assignee: Mario Fusco
> Priority: Major
>
> {code:java}
> org.drools.compiler.kie.builder.impl.InternalKieModule.createKieModule(ReleaseId releaseId, File jar)
> {code}
> has a couple of issues
> 1) there is not a check on the actual type of File received as parameter: it expects it to be a "jar" - but this is not checked anywhere - so
> {code:java}
> ZipFile zipFile = new ZipFile(jar)
> {code}
> throws an exception whenever the given file is not a "jar"
> 2) every exceptions are catch and simply logged; but it seems that whatever exception may happen inside this if
> {code:java}
> if (zipEntry != null) {
> KieModuleModel kieModuleModel = KieModuleModelImpl.fromXML( zipFile.getInputStream( zipEntry ) );
> setDefaultsforEmptyKieModule( kieModuleModel );
> return kieModuleModel != null ? InternalKieModuleProvider.get( adapt( releaseId ), kieModuleModel, jar ) : null;
> }
> {code}
> it is actually a grave exception, since it means that it was impossible to retrieve an expected KieModule out of a given "kjar" (we know it is a kjar because zipEntry != null)
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list