r6994 - dumbhippo/trunk/server/src/com/dumbhippo/web/servlets



Author: marinaz
Date: 2007-12-07 18:04:48 -0600 (Fri, 07 Dec 2007)
New Revision: 6994

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
Log:
Fix NullPointerException when there is no special message about setting an account.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2007-12-07 23:49:58 UTC (rev 6993)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2007-12-08 00:04:48 UTC (rev 6994)
@@ -172,12 +172,16 @@
 				    		try {
 				    		    Document doc = factory.newDocumentBuilder().parse(new ByteArrayInputStream(resultXml.getBytes()));
 				    		    XPath xpath = XPathFactory.newInstance().newXPath();
-				    		    String message = ((Node)xpath.evaluate("/message", doc, XPathConstants.NODE)).getTextContent();
-				    		    if (message.trim().length() > 0) {
-				    		    	accountsWithNotes.put(entry.getKey(), message);
+				    		    Node node = (Node)xpath.evaluate("/message", doc, XPathConstants.NODE);
+				    		    if (node != null) {
+				    		        String message = node.getTextContent();
+				    		        if (message.trim().length() > 0) {
+				    		    	    accountsWithNotes.put(entry.getKey(), message);
+				    		        }
 				    		    }
 				    		} catch (XPathExpressionException e) {
-					        	// that's fine, means there was no message
+				    			logger.error("Error getting a message about an external account for " + entry.getKey() + " with value " + entryValue, e);
+					        	// let's not bother the user with this, since the account must have been set succesfully
 					        }
 				    	}
 			    	} catch (XmlMethodException e) {



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