From 16e0ff316dec0e9d48c3dceae0dff1f64f5f4e7e Mon Sep 17 00:00:00 2001 From: bernd Date: Wed, 14 Nov 2012 21:24:31 +0100 Subject: [PATCH 18/25] Guard MapDataObjectBinding against setting a bad object type (can happen by providing MapDataObjectBinding as a custom resultSetBinding when it does not match the actual return type). --- eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java b/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java index 723ebf0..6883c84 100644 --- a/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java +++ b/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.Map; import net.lemnik.eodsql.EoDException; +import net.lemnik.eodsql.InvalidDataTypeException; /** * A {@link DataObjectBinding} that stores the {@link ResultSet} in a @@ -23,6 +24,13 @@ import net.lemnik.eodsql.EoDException; */ public class MapDataObjectBinding extends DataObjectBinding> { @Override + protected void setObjectType(Class> objectType) { + if (Map.class.isAssignableFrom(objectType) == false) { + throw new InvalidDataTypeException(objectType); + } + } + + @Override public Class> getObjectType() { return getStringObjectMapObjectType(); } -- 1.8.0