Merge "Bug 762: Verify input in typedef codecs"
[mdsal.git] / code-generator / binding-generator-impl / src / main / java / org / opendaylight / yangtools / sal / binding / generator / impl / LazyGeneratedCodecRegistry.java
index 65b3f668e256514fda61c968180ab21b02fe8289..68685792593181f5beeb6d61e7dd91ec37b3f392 100644 (file)
@@ -1294,7 +1294,7 @@ class LazyGeneratedCodecRegistry implements //
         public Class<?> deserialize(final QName input) {
             Type type = qnamesToIdentityMap.get(input);
             if (type == null) {
-                return null;
+                throw new IllegalArgumentException( "Invalid value \"" + input + "\"." );
             }
             ReferencedTypeImpl typeref = new ReferencedTypeImpl(type.getPackageName(), type.getName());
             WeakReference<Class> softref = typeToClass.get(typeref);
@@ -1319,7 +1319,7 @@ class LazyGeneratedCodecRegistry implements //
         public Object deserialize(final Object input, final InstanceIdentifier bindingIdentifier) {
             Type type = qnamesToIdentityMap.get(input);
             if (type == null) {
-                return null;
+                throw new IllegalArgumentException( "Invalid for \"" + input + "\"." );
             }
             ReferencedTypeImpl typeref = new ReferencedTypeImpl(type.getPackageName(), type.getName());
             WeakReference<Class> softref = typeToClass.get(typeref);