r7249 - in dumbhippo/trunk/server/src/com/dumbhippo: server/impl services



Author: marinaz
Date: 2008-01-22 13:37:37 -0600 (Tue, 22 Jan 2008)
New Revision: 7249

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/AmazonUpdaterBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/services/AmazonWebServices.java
Log:
Prevent a NullPointerException when we are looking up wish list details for a list for
which information is not available from Amazon Web Services.

Document a bug with Amazon Web Services that results in a list id for a list that we 
can't access being returned when we are looking up customer list ids.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/AmazonUpdaterBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/AmazonUpdaterBean.java	2008-01-22 16:58:56 UTC (rev 7248)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/AmazonUpdaterBean.java	2008-01-22 19:37:37 UTC (rev 7249)
@@ -407,8 +407,18 @@
 					// and getting the results only if the wish list items count changed or the results in cache expired	
 					// we also get the results if the list name changed
 				    AmazonListView newList = ws.getListDetails(list.getListId());
-                    if (newList.getTotalItems() != list.getTotalItems() ||
-                        !newList.getListName().equals(list.getListName())) {
+				    // If newList is null or doesn't contain the name information, it likely means
+				    // that it is not accessible to us at the time, and we should not try to update it.
+				    // There currently seems to be a bug with Amazon Web services, where 
+				    // Operation=CustomerContentLookup&ResponseGroup=CustomerLists returns a list id
+				    // for which Operation=ListLookup returns that the list is not accessible. The request
+				    // for CustomerLists fails to return the updates lists for the customer.
+				    // For example, for Amazon user "A3OT23RTSWVTNU", the CustomerLists request returns list 
+				    // id "PFM223QGUIDV" which is not accessible and fails to return list id "2BRM5JKMES3FN"
+				    // which is this person's actual public wish list.
+                    if (newList != null && newList.getListName() != null && 
+                    	(newList.getTotalItems() != list.getTotalItems() ||
+                         !newList.getListName().equals(list.getListName()))) {
                     	needListCacheUpdate = true;
                     }
 				}

Modified: dumbhippo/trunk/server/src/com/dumbhippo/services/AmazonWebServices.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/services/AmazonWebServices.java	2008-01-22 16:58:56 UTC (rev 7248)
+++ dumbhippo/trunk/server/src/com/dumbhippo/services/AmazonWebServices.java	2008-01-22 19:37:37 UTC (rev 7249)
@@ -227,6 +227,8 @@
 		return amazonList;	
 	}
 	
+	// This methos will return null of the list is no longer accessible through
+	// ECS (perhaps it was made private).
 	public AmazonList getListDetails(String listId) {
 	    String wsUrl = createListRequest(listId, false, -1);	
 	    AmazonSaxHandler handler = parseUrl(new AmazonSaxHandler(false), wsUrl);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]