From 40723a37cc98de6c7dc396ca2558f7ef51e7337a Mon Sep 17 00:00:00 2001 From: Jakub Morvay Date: Tue, 28 Feb 2017 08:28:01 +0100 Subject: [PATCH 1/1] Fix NPE in YangTextSchemaSourceSerializationProxy#getRepresentation According to its general contract, when revision is not found, SourceIdentifier#getRevision method returns null. Wrap revision in Optional#fromNullable to avoid possible NPE. Change-Id: I78f544374f179c9486cc8dd09cbcf1eea379e1e9 Signed-off-by: Jakub Morvay --- .../provider/impl/YangTextSchemaSourceSerializationProxy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/YangTextSchemaSourceSerializationProxy.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/YangTextSchemaSourceSerializationProxy.java index 6e6c6a88f1..39302e4f56 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/YangTextSchemaSourceSerializationProxy.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/YangTextSchemaSourceSerializationProxy.java @@ -34,7 +34,7 @@ public class YangTextSchemaSourceSerializationProxy implements Serializable { } public YangTextSchemaSource getRepresentation() { - return YangTextSchemaSource.delegateForByteSource(RevisionSourceIdentifier.create(name, Optional.of(revision)), - ByteSource.wrap(schemaSource)); + return YangTextSchemaSource.delegateForByteSource( + RevisionSourceIdentifier.create(name, Optional.fromNullable(revision)), ByteSource.wrap(schemaSource)); } } -- 2.36.6