[CONTROLLER-1247] More graceful handling of nulls in Lists Created: 12/Apr/15  Updated: 25/Jul/23  Resolved: 09/Jun/15

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Ed Warnicke Assignee: Tony Tkacik
Resolution: Won't Do 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: 2979

 Description   

Recently encountered a somewhat cryptic exception from the MD-SAL that turned out to be rooted in having null values in a List.

It would be nice if either:

a) We threw the NPE with a clear error message at .build() time
or
b) We threw a more descriptive exception when we encounter nulls in lists
in the codecs
or
c) Both

The exception encountered was this:

java.lang.NullPointerException
at org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow$StreamWriter.serialize(DataObjectSerializerPrototype.java)[264:org.opendaylight.openflowplugin.model.flow-service:0.1.0.SNAPSHOT]
at org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table$StreamWriter.serialize(DataObjectSerializerPrototype.java)[264:org.opendaylight.openflowplugin.model.flow-service:0.1.0.SNAPSHOT]
at org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry$DataObjectSerializerProxy.serialize(BindingNormalizedNodeCodecRegistry.java:294)[181:org.opendaylight.yangtools.binding-data-codec:0.7.0.SNAPSHOT]
at org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry.toNormalizedNode(BindingNormalizedNodeCodecRegistry.java:105)[181:org.opendaylight.yangtools.binding-data-codec:0.7.0.SNAPSHOT]
at org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec.toNormalizedNode(BindingToNormalizedNodeCodec.java:75)[232:org.opendaylight.controller.sal-binding-broker-impl:1.2.0.SNAPSHOT]
at org.opendaylight.controller.md.sal.binding.impl.AbstractWriteTransaction.put(AbstractWriteTransaction.java:42)[232:org.opendaylight.controller.sal-binding-broker-impl:1.2.0.SNAPSHOT]
at org.opendaylight.groupbasedpolicy.renderer.ofoverlay.PolicyManager$FlowMap.commitToDataStore(PolicyManager.java:253)[283:org.opendaylight.groupbasedpolicy.ofoverlay-renderer:0.2.0.SNAPSHOT]
at org.opendaylight.groupbasedpolicy.renderer.ofoverlay.PolicyManager$FlowUpdateTask.run(PolicyManager.java:335)[283:org.opendaylight.groupbasedpolicy.ofoverlay-renderer:0.2.0.SNAPSHOT]
at org.opendaylight.groupbasedpolicy.util.SingletonTask$SingletonTaskWorker.run(SingletonTask.java:60)[259:org.opendaylight.groupbasedpolicy:0.2.0.SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_72]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_72]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_72]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_72]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_72]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_72]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_72]



 Comments   
Comment by Tony Tkacik [ 13/Apr/15 ]

This seems builder was supplied with List (implementation) which allowed null values.

Comment by Robert Varga [ 01/Jun/15 ]

Checking for nulls in collection will have a huge performance impact.

Generated at Wed Feb 07 19:55:03 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.