We should never attempt to deserialize null values for keys,
defend against them.
Change-Id: I6439bb6ce22da11476cd4f8bd89e3ec04c05ba96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*/
package org.opendaylight.mdsal.binding.dom.codec.impl;
*/
package org.opendaylight.mdsal.binding.dom.codec.impl;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Verify.verifyNotNull;
+
import com.google.common.base.Throwables;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import com.google.common.base.Throwables;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
throw new IllegalStateException(e);
}
throw new IllegalStateException(e);
}
- Preconditions.checkArgument(value != null,
- "All keys must be specified for %s. Missing key is %s. Supplied key is %s",
+ checkArgument(value != null, "All keys must be specified for %s. Missing key is %s. Supplied key is %s",
identifier, getterName, obj);
return codec.serialize(value);
}
Object deserialize(final Object obj) {
identifier, getterName, obj);
return codec.serialize(value);
}
Object deserialize(final Object obj) {
- return codec.deserialize(obj);
+ checkArgument(obj != null, "Attempted to serialize null for %s component of %s", getterName, identifier);
+ return verifyNotNull(codec.deserialize(obj), "Codec for %s of %s returned null for %s", getterName, identifier,
+ obj);
-
-}
\ No newline at end of file