You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/06/27 13:40:36 UTC
svn commit: r1750334 - in /qpid/java/trunk/broker-core/src:
main/java/org/apache/qpid/server/model/AttributeValueConverter.java
test/java/org/apache/qpid/server/model/AttributeValueConverterTest.java
Author: rgodfrey
Date: Mon Jun 27 13:40:36 2016
New Revision: 1750334
URL: http://svn.apache.org/viewvc?rev=1750334&view=rev
Log:
QPID-6954 : Fix conversion on getters, add test
Modified:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/AttributeValueConverterTest.java
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java?rev=1750334&r1=1750333&r2=1750334&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java Mon Jun 27 13:40:36 2016
@@ -1148,7 +1148,7 @@ abstract class AttributeValueConverter<T
Map map = (Map) value;
if(converter != null)
{
- return converter.convert(map.get(getNameFromMethod(method, getTypeFromMethod(method))), object);
+ return convertValue(map, converter, method);
}
else if("toString".equals(method.getName()) && method.getParameterTypes().length == 0)
{
@@ -1181,7 +1181,7 @@ abstract class AttributeValueConverter<T
return false;
}
}
- return converter == null ? null : convertValue(map, converter, method);
+ throw new UnsupportedOperationException("The proxy class implements only attribute getters and toString(), hashCode() and equals()");
}
private Object convertValue(final Map map,
Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/AttributeValueConverterTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/AttributeValueConverterTest.java?rev=1750334&r1=1750333&r2=1750334&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/AttributeValueConverterTest.java (original)
+++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/AttributeValueConverterTest.java Mon Jun 27 13:40:36 2016
@@ -304,6 +304,14 @@ public class AttributeValueConverterTest
assertEquals(expectedIntegerPrimitiveValue, value.getInt());
assertNull(expectedStringValue, value.getAnotherString());
+ final TestManagedAttributeValue nullValues = converter.convert(Collections.emptyMap(), object);
+
+ assertNull(nullValues.getString());
+ assertNull(nullValues.getInteger());
+ assertEquals(0, nullValues.getInt());
+ assertNull(expectedStringValue, nullValues.getAnotherString());
+
+
// TODO: should changes to the underlying map be visible?
// input.put("anotherString", "laterchange");
// assertNull(expectedStringValue, value.getAnotherString());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org