Try changing the code to this, let me know if it fixes the problem and I'll apply to trunk. any chance you could send us a mini self contained unit test for this bug?

   public synchronized void addPackage(final Package newPkg) {
PackageRegistry pkgRegistry = this.pkgRegistryMap.get( newPkg.getName() );
       Package pkg = null;
       if ( pkgRegistry != null ) {
           pkg = pkgRegistry.getPackage();
       }

       if ( pkg == null ) {
pkg = newPackage( new PackageDescr( newPkg.getName() ) ).getPackage();
       }

Zoltan Farkas wrote:
PackageBuilder.java at line 688:
public synchronized void addPackage(final Package newPkg) { Package pkg = this.pkgRegistryMap.get( newPkg.getName() ).getPackage(); if pkgRegistryMap is empty as it should probably be initially adding a new package will cause a NPE. This fuction assumes that there is always a package in the packageRegistryMap. I am getting a NPE when I am trying something like: KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newUrlResource("a valid url"),
                        ResourceType.PKG);
thanks for any help --zoly
------------------------------------------------------------------------

_______________________________________________
rules-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-dev

_______________________________________________
rules-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-dev

Reply via email to