[jboss-jira] [JBoss JIRA] (DROOLS-110) KieModuleMetaData: Java Beans must have an explicit package (i.e. default package causes NPE)
Michael Anstis (JIRA)
jira-events at lists.jboss.org
Fri Apr 26 09:42:53 EDT 2013
[ https://issues.jboss.org/browse/DROOLS-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770407#comment-12770407 ]
Michael Anstis commented on DROOLS-110:
---------------------------------------
Proposed changes to fix:-
KieModuleMetaDataImpl.java
public Class<?> getClass(String pkgName, String className) {
try {
>> if(!(pkgName==null || pkgName.isEmpty())) {
>> return Class.forName(pkgName + "." + className, false, getClassLoader());
>> }
>> return Class.forName(className, false, getClassLoader());
} catch (ClassNotFoundException e) {
return null;
}
}
org.drools.core.util.ClassUtils$MapClassLoader:-
public Class<?> fastFindClass( final String name ) {
Class<?> cls = findLoadedClass( name );
if (cls == null) {
final byte[] clazzBytes = this.map.get( convertClassToResourcePath( name ) );
if (clazzBytes != null) {
>> String pkgName = "";
>> if(name.lastIndexOf( '.' ) > 0) {
>> pkgName = name.substring( 0,
>> name.lastIndexOf( '.' ) );
>> }
if (getPackage( pkgName ) == null) {
definePackage( pkgName,
"",
"",
"",
"",
"",
"",
null );
}
cls = defineClass( name,
clazzBytes,
0,
clazzBytes.length,
PROTECTION_DOMAIN );
}
if (cls != null) {
resolveClass( cls );
}
}
return cls;
}
> KieModuleMetaData: Java Beans must have an explicit package (i.e. default package causes NPE)
> ---------------------------------------------------------------------------------------------
>
> Key: DROOLS-110
> URL: https://issues.jboss.org/browse/DROOLS-110
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 6.0.0.Beta2
> Reporter: Michael Anstis
> Assignee: Mark Proctor
>
> Please see test here: http://github.com/droolsjbpm/drools/commit/01049a2de
> Java Beans must have an explicit package. This cannot be guaranteed (although it is accepted as best practice).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list