Author: lindner
Date: Wed Aug 27 14:43:53 2008
New Revision: 689633

URL: http://svn.apache.org/viewvc?rev=689633&view=rev
Log:
avoid NPEs due to buggy SPI 
implementationsjava/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ApiServlet.java

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

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ApiServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ApiServlet.java?rev=689633&r1=689632&r2=689633&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ApiServlet.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ApiServlet.java
 Wed Aug 27 14:43:53 2008
@@ -82,8 +82,11 @@
   }
 
   protected ResponseItem getResponseItem(Future<? extends ResponseItem> 
future) {
-    ResponseItem response;
+    ResponseItem response = null;
     try {
+      if (future != null) {
+        response = future.get();
+      }
       // TODO: use timeout methods?
       response = future.get();
     } catch (InterruptedException ie) {
@@ -91,7 +94,8 @@
     } catch (ExecutionException ee) {
       response = responseItemFromException(ee.getCause());
     }
-    return response;
+    return (response != null) ? response :
+      new ResponseItem(ResponseError.INTERNAL_ERROR, "null response from spi");
   }
 
   protected ResponseItem responseItemFromException(Throwable t) {


Reply via email to