-
Bug
-
Resolution: Done
-
Minor
-
7.0.0.Beta2
-
None
-
NEW
-
NEW
When using a custom shadow variable with a reference to another custom shadow variable like in the example below:
@PlanningVariable(valueRangeProviderRefs = {"routeRange", "itemRange"}, graphType = CHAINED) public RoutePunt getPreviousRoutePunt() { return previousRoutePunt; } @CustomShadowVariable(variableListenerClass = ItemTimeUpdatingVariableListener.class, sources = { @PlanningVariableReference(variableName = "previousRoutePunt"), @PlanningVariableReference(variableName = "route"), @PlanningVariableReference(variableName = "nextItem")}) public Duration getActualDuration() { return actualDuration; } @CustomShadowVariable(variableListenerRef = @PlanningVariableReference(variableName = "actualDuration")) public LocalDateTime getPlannedArrivalTime() { return plannedArrivalTime; }
When a corruption occurs in the plannedArrivalTime (example above) the following NPE appears.
Exception in thread "1" java.lang.NullPointerException at org.optaplanner.core.impl.score.director.AbstractScoreDirector.assertShadowVariablesAreNotStale(AbstractScoreDirector.java:415) at org.optaplanner.core.impl.solver.recaller.BestSolutionRecaller.solvingStarted(BestSolutionRecaller.java:83) at org.optaplanner.core.impl.solver.DefaultSolver.solvingStarted(DefaultSolver.java:218) at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:197) at x.x.x.x.x.lambda$null$1(x.java:48) at java.lang.Thread.run(Thread.java:745)
This is caused by the VariableListenerClass which is null on referenced shadow variable