Author: [email protected]
Date: Fri Aug 26 16:12:57 2011
New Revision: 1349
Log:
[AMDATUOPENSOCIAL-107] Changed generic stuff, otherwise non-String AppData was
also converted to String.
Modified:
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/persistence/AppDataServiceImpl.java
Modified:
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/persistence/AppDataServiceImpl.java
==============================================================================
---
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/persistence/AppDataServiceImpl.java
(original)
+++
trunk/amdatu-opensocial/opensocial-shindig/src/main/java/org/amdatu/opensocial/shindig/persistence/AppDataServiceImpl.java
Fri Aug 26 16:12:57 2011
@@ -67,7 +67,9 @@
if (user != null) {
// Convert the String Map to a byte array and write it to
UserAdmin
try {
- Map<String, String> newValues = addValues(user, values,
appId);
+ // Note that although the values parameter of this method
are typed Map<String, String>,
+ // the map may in fact contain any type of Object.
+ Map<String, ?> newValues = addValues(user, values, appId);
byte[] bytesValue =
ConversionUtil.objectToByteArray(newValues);
if (appId == null) {
user.getProperties().put(APP_DATA, bytesValue);
@@ -97,7 +99,7 @@
// Append/overwrite values to the current APP_DATA properties of the user
@SuppressWarnings("unchecked")
- private Map<String, String> addValues(User user, Map<String, String>
values, String appId) throws ClassNotFoundException, IOException {
+ private Map<String, ?> addValues(User user, Map<String, String> values,
String appId) throws ClassNotFoundException, IOException {
byte[] currentProperties;
if (appId == null) {
currentProperties = (byte[]) user.getProperties().get(APP_DATA);
@@ -107,12 +109,11 @@
if (currentProperties == null) {
return values;
}
- Map<String, String> currentValues = (Map<String, String>)
ConversionUtil.byteArrayToObject(currentProperties);
+ Map<String, Object> currentValues = (Map<String, Object>)
ConversionUtil.byteArrayToObject(currentProperties);
for (String key : values.keySet()) {
// Despite the generic stuff, at runtime the posted AppData values
might still contain Integers, Doubles
// and other primitive types. Therefore we explicitly invoke
toString() on them.
- Object value = values.get(key);
- currentValues.put(key, value.toString());
+ currentValues.put(key, values.get(key));
}
return currentValues;
}
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits