Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1276

KieContainer.newKieSession((String) null) should return the default ksession to be consistent with getKieSessionModel(null)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Critical Critical
    • None
    • 6.5.0.CR1
    • core engine
    • None
    • NEW
    • NEW

      This works to get the default kieSession:

              String ksessionName = null;
              // if ksessionName is null, then the default kieSession is used
              KieSessionModel kieSessionModel = kieContainer.getKieSessionModel(ksessionName);
      

      But this doesn't work to get the default ksession:

              String ksessionName = null;
              // Fails if ksessionName is null. Should return the default ksession instead.
              return kieContainer.newKieSession(ksessionName);
      

      The above fails if ksessioName is null with this stacktrace:

      java.lang.NullPointerException
      	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
      	at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:692)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:652)
      	at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirectorFactory.newKieSession(DroolsScoreDirectorFactory.java:129)
      

      If no default ksession exists with argument null, a nice error message should be thrown.

              mfusco@redhat.com Mario Fusco
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: