Elffuss BraidHub

kikocis/java-driver public

Authorize Null parameter in Accessor method (JAVA-575).
Changeset62fd71450110dbf031db27f4c49e0bfb920a2f1f30d69c9990ee5c9ffd769cea
AuthorEric LELEU <eric.leleu@atos.net> · 2014-12-08 10:27 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2015-03-04 19:28 -08:00
Parents8dbbb33ac272

Browse the files at this changeset

2 files changed

modified driver-core/CHANGELOG.rst +2 −0
@@ -4,6 +4,8 @@
44 2.1.5:
55 ------
66
7+- [bug] Authorize Null parameter in Accessor method (JAVA-575)
8+
79 Merged from 2.0 branch:
810
911 - [new feature] Add AddressTranslater for EC2 multi-region deployment (JAVA-518)
modified driver-mapping/src/main/java/com/datastax/driver/mapping/MethodMapper.java +8 −3
@@ -95,7 +95,7 @@
9595 }
9696
9797 @SuppressWarnings("rawtypes")
98- private void mapType(MappingManager manager, Class<?> fullReturnType, Type type) {
98+ private void mapType(MappingManager manager, Class<?> fullReturnType, Type type) {
9999
100100 if (type instanceof ParameterizedType) {
101101 ParameterizedType pt = (ParameterizedType)type;
@@ -167,9 +167,14 @@
167167 }
168168
169169 void setValue(BoundStatement boundStatement, Object arg, ProtocolVersion protocolVersion) {
170- if (arg != null) {
171- if (paramName == null)
170+ if (paramName == null) {
171+ if (arg == null)
172+ boundStatement.setToNull(paramIdx);
173+ else
172174 boundStatement.setBytesUnsafe(paramIdx, DataType.serializeValue(arg, protocolVersion));
175+ } else {
176+ if (arg == null)
177+ boundStatement.setToNull(paramName);
173178 else
174179 boundStatement.setBytesUnsafe(paramName, DataType.serializeValue(arg, protocolVersion));
175180 }