r7091 - in dumbhippo/trunk/server/src/com/dumbhippo: server/impl web/servlets



Author: marinaz
Date: 2007-12-19 11:38:35 -0600 (Wed, 19 Dec 2007)
New Revision: 7091

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
Log:
Check if an XmlBuilder has anything in it before parsing it.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2007-12-19 05:10:06 UTC (rev 7090)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2007-12-19 17:38:35 UTC (rev 7091)
@@ -608,13 +608,13 @@
 		// <fb:action> tag doesn't work inside <fb:visible-to-owner>,
 		// so we need to use the following barbaric methods to right align the 'Edit Account' action 
 		fbmlSb.append("<fb:wide>");	
-		for (int i=1; i<=50; i++ ) {
+		for (int i=1; i<=62; i++ ) {
 		    fbmlSb.append("&nbsp;");
 		}
 		fbmlSb.append("</fb:wide>");	
 		
 		fbmlSb.append("<fb:narrow>");	
-		for (int i=1; i<=14; i++ ) {
+		for (int i=1; i<=18; i++ ) {
 		    fbmlSb.append("&nbsp;");
 		}
 		fbmlSb.append("</fb:narrow>");

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2007-12-19 05:10:06 UTC (rev 7090)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2007-12-19 17:38:35 UTC (rev 7091)
@@ -216,20 +216,22 @@
 				    		// we have messages telling the user about certain limitations of their account
 				    		// for MySpace, Twitter, Reddit, and Amazon
 				    		accountsSetSuccessful.add(entry.getKey());
-				    		try {
-				    		    Document doc = factory.newDocumentBuilder().parse(new ByteArrayInputStream(resultXml.getBytes()));
-				    		    XPath xpath = XPathFactory.newInstance().newXPath();
-				    		    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) {
-				    			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
-					        }
+				    		if (resultXml.getBytes().length > 0) {
+					    		try {
+					    		    Document doc = factory.newDocumentBuilder().parse(new ByteArrayInputStream(resultXml.getBytes()));
+					    		    XPath xpath = XPathFactory.newInstance().newXPath();
+					    		    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) {
+					    			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) {
 			    		// in all cases except for the Flickr one, if the XmlMethodException will be thrown, it will be



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