Eclipse (rightfully) flags this access as potentiall null. Since
we are invoking an interface getter, it is not statically known that
the two invocations will return the same value.
Cache the second field access in a local variable, which ensures
we access the property exactly once, which keeps eclipse happy.
In case the implementation LazyDataObjectModification, this has
the benefit of not deserializing twice.
Change-Id: Idfb8c631bc0267a63710c2cb650e6bda1c227df3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
final DataObjectModification<Attributes> attUpdate = table.getModifiedChildContainer(Attributes.class);
- if (attUpdate != null && attUpdate.getDataAfter() != null) {
+ if (attUpdate != null) {
final Attributes newAttValue = attUpdate.getDataAfter();
- LOG.trace("Uptodate found for {}", newAttValue);
- tx.put(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.child(Attributes.class), newAttValue);
+ if (newAttValue != null) {
+ LOG.trace("Uptodate found for {}", newAttValue);
+ tx.put(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.child(Attributes.class), newAttValue);
+ }
}
final DataObjectModification<S> routesChangesContainer