[jboss-jira] [JBoss JIRA] (JBRULES-3439) NPE in AbstractTabuAcceptor.stepTaken
Geoffrey De Smet (JIRA)
jira-events at lists.jboss.org
Sat Mar 31 05:56:48 EDT 2012
[ https://issues.jboss.org/browse/JBRULES-3439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680768#comment-12680768 ]
Geoffrey De Smet commented on JBRULES-3439:
-------------------------------------------
Thank you for this bug report, this looks like a genuine issue. Presuming it's indeed the 5.4.0-SNAPSHOT of 29 march (which hasn't changed related to TabuAccepter in the last few days), then it's this code going wrong
{code}
int tabuStepIndex = localSearchStepScope.getStepIndex();
// Remove the oldest tabu(s)
for (Iterator<Object> it = tabuSequenceList.iterator(); it.hasNext();) {
Object oldTabu = it.next();
Integer oldTabuStepIndexInteger = tabuToStepIndexMap.get(oldTabu); // So this returns null? Impossible! :)
int oldTabuStepCount = tabuStepIndex - oldTabuStepIndexInteger;
...
}
{code}
I don't want to introduce defensive code there, because in theory that NPE can never happen:
- any object in tabuSequenceList is also in tabuToStepIndexMap (and vice versa)
So it's a bug, not just an unhelpful error message (in fact the only helpful error message would be "there a bug and it's not your fault and it shouldn't be there in the first place").
Can you help me reproduce the problem locally? Either by sending me your code
or - much easier for me - add an extra test on PlanningEntityTabuAcceptorTest and create a pull request on github for it.
drools-planner/drools-planner-core/src/test/java/org/drools/planner/core/localsearch/decider/acceptor/tabu/PlanningEntityTabuAcceptorTest.java
http://help.github.com/send-pull-requests/
> NPE in AbstractTabuAcceptor.stepTaken
> -------------------------------------
>
> Key: JBRULES-3439
> URL: https://issues.jboss.org/browse/JBRULES-3439
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-planner
> Affects Versions: 5.4.0.Beta2
> Environment: drools-planner-example 5.4.0-SNAPSHOT pulled via Maven on March 29. I believe this corresponds to https://github.com/droolsjbpm/drools-planner/commit/ba38344b7563830eb2a725f78c03be043b1c1f65
> Reporter: Chris Dolan
> Assignee: Geoffrey De Smet
>
> I know this is a weak bug report and I apologize in advance for that...
> I'm writing integration tests for my solver configuration. My code seems to work in my GUI (subclass of CommonApp) but it fails under my junit test. I'm quite new to Drools and Planner so I wouldn't be surprised if the root cause is my fault, but I think a NPE is bad news.
> {noformat}
> 2012-03-30 15:26:05,743 INFO [DefaultSolver.java:172] Solving started: time spend (25), score (-2hard/-26soft), new best score (-2hard/-26soft), random seed (0). - o.d.p.c.s.DefaultSolver
> 2012-03-30 15:26:05,786 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (0), time spend (68), score (-1hard/-22soft), new best score (-1hard/-22soft), accepted move size (8) for picked step (JobSlot(s2,0) => Job(j1)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> 2012-03-30 15:26:05,815 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (1), time spend (97), score (0hard/-8soft), new best score (0hard/-8soft), accepted move size (11) for picked step (JobSlot(s1,0) => Job(j2)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> 2012-03-30 15:26:05,831 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (2), time spend (113), score (0hard/-4soft), new best score (0hard/-4soft), accepted move size (13) for picked step (JobSlot(s1,1) => Job(j1)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> 2012-03-30 15:26:05,845 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (3), time spend (127), score (0hard/-2soft), new best score (0hard/-2soft), accepted move size (13) for picked step (JobSlot(s2,1) => Job(j2)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> java.lang.NullPointerException
> at org.drools.planner.core.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.stepTaken(AbstractTabuAcceptor.java:163)
> at org.drools.planner.core.localsearch.decider.DefaultDecider.stepTaken(DefaultDecider.java:167)
> at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.stepTaken(DefaultLocalSearchSolverPhase.java:107)
> at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:71)
> at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:181)
> at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:150)
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list