Check for null pointer when parsing identities. 13/9913/1
authorMaros Marsalek <mmarsale@cisco.com>
Wed, 13 Aug 2014 09:21:41 +0000 (11:21 +0200)
committerMaros Marsalek <mmarsale@cisco.com>
Wed, 13 Aug 2014 09:21:41 +0000 (11:21 +0200)
Change-Id: I5dba7506b83f145472f7327f92e47ffc17b74062
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/InstanceIdentifierForXmlCodec.java

index 0ad2fc213438c39e23fc2eb530dd1d06984c918c..7f8167e451559e0643d310a2967272c8c0a043fd 100644 (file)
@@ -152,7 +152,8 @@ public final class InstanceIdentifierForXmlCodec {
             throw new IllegalArgumentException("It wasn't possible to get namespace for prefix " + prefix);
         }
 
-        Module module = schemaContext.findModuleByNamespaceAndRevision(namespace, null);
+        final Module module = schemaContext.findModuleByNamespaceAndRevision(namespace, null);
+        Preconditions.checkNotNull(module, "Unknown module: %s, cannot parse identity %s", namespace, xPathArgument);
         return QName.create(module.getQNameModule(), identifier);
     }