Author: ieb
Date: Sun Jul 20 11:00:12 2008
New Revision: 678289

URL: http://svn.apache.org/viewvc?rev=678289&view=rev
Log:
Fixed some issues when wiring the json-lib converter into the EndToEnd tests 
where an empty
String was not being converted as an empty object. The commit does only fixes 
the issues in the JsonLibConverter,
I am keeping the intergration changes local to avoid disruption.

Modified:
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverter.java

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverter.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverter.java?rev=678289&r1=678288&r2=678289&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverter.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverter.java
 Sun Jul 20 11:00:12 2008
@@ -89,6 +89,9 @@
   @SuppressWarnings("unchecked")
   public <T> T convertToObject(String string, final Class<T> rootBeanClass) {
 
+    if ( "".equals(string) ) {
+      string = "{}";
+    }
     if (string.startsWith("[")) {
       JSONArray jsonArray = JSONArray.fromObject(string, jsonConfig);
       if (debugMode) {
@@ -260,7 +263,10 @@
   }
 
   public String convertToString(Object pojo) {
-
+    if ( "".equals(pojo) ) {
+      return "{}";
+    }
+    
     try {
       JSONObject jsonObject = JSONObject.fromObject(pojo, jsonConfig);
       return jsonObject.toString();


Reply via email to