Merge "Bug 762: Verify input in typedef codecs"
authorTony Tkacik <ttkacik@cisco.com>
Tue, 1 Jul 2014 14:51:27 +0000 (14:51 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 1 Jul 2014 14:51:27 +0000 (14:51 +0000)
1  2 
code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/LazyGeneratedCodecRegistry.java

index 65b3f668e256514fda61c968180ab21b02fe8289,e132035e88951006d243db6d68dbf0b724f1060a..68685792593181f5beeb6d61e7dd91ec37b3f392
@@@ -706,7 -706,7 +706,7 @@@ class LazyGeneratedCodecRegistry implem
              if (adaptedForPaths.contains(path)) {
                  return;
              }
 -            LOG.info("Adapting mixin codec {} for path {}",this,path);
 +            LOG.debug("Adapting mixin codec {} for path {}",this,path);
              /**
               * We search in schema context if the use of this location aware
               * codec (augmentable codec, case codec) makes sense on provided
          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);
          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);