Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-238

NullPointerException when calling ScoreDirector.beforeEntityAdded with new Vehicle

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 6.1.0.CR2
    • 6.0.1.Final
    • optaplanner-core
    • None
    • Workaround Exists
    • Hide

      Workaround for 6.0.1:
      Presuming you're doing this in a ProblemFactChange, call scoreDirector.beforeProblemFactRemoved() instead of beforeEntityRemoved()
      => Treat it as a problem fact for that... but treat is as an entity for everything else.

      Show
      Workaround for 6.0.1: Presuming you're doing this in a ProblemFactChange, call scoreDirector.beforeProblemFactRemoved() instead of beforeEntityRemoved() => Treat it as a problem fact for that... but treat is as an entity for everything else.

      Flowing the code of VehicleRoutingPanel.insertLocationAndCustomer to insert a new Vehicle to the solution, my code is failing when the new Vehicle is reported to the score director:
      scoreDirector.beforeEntityAdded(newVehicle);

      The exception is NullPointerException at

      org.optaplanner.core.impl.domain.variable.listener.PlanningVariableListenerSupport.beforeEntityAdded(PlanningVariableListenerSupport.java:54) 
      

            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            hagai.shatz Hagai Shatz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: