[OPNFLWPLUG-380] NPE caused by areObjectsEqual passed with storedMatch==null Created: 18/Mar/15  Updated: 27/Sep/21  Resolved: 13/Apr/15

Status: Resolved
Project: OpenFlowPlugin
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Keith Burns Assignee: Keith Burns
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 2861

 Description   

Seeing these continually throughout our logs:

2015-03-17 05:11:30,428 | WARN | ds-oper-thread-0 | StatisticsManagerImpl | 246 - org.opendaylight.openflowplugin.applications.statistics-manager - 0.1.0.SNAPSHOT | Unhandled exception during processing statistics. Restarting transaction chain.
java.lang.NullPointerException
at org.opendaylight.openflowplugin.applications.statistics.manager.impl.helper.MatchComparatorFactory$11.areObjectsEqual(MatchComparatorFactory.java:211)[246:org.opendaylight.openflowplugin.applications.statistics-manager:0.1.0.SNAPSHOT]
at org.opendaylight.openflowplugin.applications.statistics.manager.impl.helper.MatchComparatorFactory$11.areObjectsEqual(MatchComparatorFactory.java:205)[246:org.opendaylight.openflowplugin.applications.statistics-manager:0.1.0.SNAPSHOT]

On further investigation:

FlowComparatorFactory Line144 calls
-> matchComp.areObjectsEqual(statsMatch, storedMatch) where storedMatch==null.

MatchComparatorFactory Line211 tries to access storedMatch.getEthernetMatch() where storedMatch==null.

The real question is whether the case where storedMatch should ever be null…

I think it is, as it is all kicked off by StatListenCommitFlow Line360, for which our cfgFlow is a “drop|null” which won’t have a match…

Actually this repeated pattern of “areObjectsEqual()” doesn’t seem to check if parameters are null before accessing their getters.

areObjectsEqual should
if(storedMatch==null) return false;

Submitting patch for fix with UnitTest



 Comments   
Comment by Keith Burns [ 18/Mar/15 ]

https://git.opendaylight.org/gerrit/#/c/16738/

Comment by Abhijit Kumbhare [ 13/Apr/15 ]

Looks like this has been fixed.

Generated at Wed Feb 07 20:32:18 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.