r7267 - dumbhippo/trunk/server/src/com/dumbhippo/services



Author: otaylor
Date: 2008-01-27 12:38:44 -0600 (Sun, 27 Jan 2008)
New Revision: 7267

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/services/AbstractXmlRequest.java
Log:
Don't log a backtrace when Yahoo replies to a failed search request with '<!-- some comment -->' and nothing more.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/services/AbstractXmlRequest.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/services/AbstractXmlRequest.java	2008-01-25 23:49:24 UTC (rev 7266)
+++ dumbhippo/trunk/server/src/com/dumbhippo/services/AbstractXmlRequest.java	2008-01-27 18:38:44 UTC (rev 7267)
@@ -40,7 +40,13 @@
 				logger.debug("normal/expected error from web service: {}", e.getMessage());
 			return null;
 		} catch (SAXException e) {
-			logger.warn("parse error on web server reply", e);
+			// The Yahoo search services in particular sometimes send empty documents
+			// for "no results"; special case this to avoid cluttering the logs with
+			// backtraces.
+			if (e.getMessage() != null && e.getMessage().indexOf("Premature end of file") >= 0)
+				logger.warn("Web service sent an incomplete XML document");
+			else
+				logger.warn("parse error on web server reply", e);
 			return null;
 		} catch (IOException e) {
 			logger.debug("IO error talking to web server: {}", e.getMessage());



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