W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2009

2006/unicorn/src/org/w3c/unicorn/action ObserveAction.java,1.50,1.51

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 09 Oct 2009 14:58:52 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MwGvk-0004oC-LJ@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv18379/src/org/w3c/unicorn/action

Modified Files:
	ObserveAction.java 
Log Message:
allows empty exceptions without NPE

Index: ObserveAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/ObserveAction.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- ObserveAction.java	7 Oct 2009 12:48:18 -0000	1.50
+++ ObserveAction.java	9 Oct 2009 14:58:50 -0000	1.51
@@ -167,9 +167,10 @@
 				} else if (paramName.equals("uri")) {
 					String uriParam = (String) reqParams.get(key);
 					if (uriParam.equals("referer")) {
-						uriParam = req.getHeader("Referer");
-						if (uriParam == null)
+						if (req.getHeader("Referer") == null)
 							messages.add(new Message(Message.ERROR, "$message_no_referer"));
+						else
+							uriParam = req.getHeader("Referer");
 					}
 					logger.trace("Uri parameter: " + key + " - " + uriParam);
 					aUnicornCall.setInputParameter(new URIInputParameter(uriParam));
@@ -273,11 +274,11 @@
 			} else {
 				aOutputModule.produceOutput(mapOfStringObject, resp.getWriter());
 			}
-		} catch (final UnicornException ucnException) {
-			if (ucnException.getUnicornMessage() != null)
-				messages.add(ucnException.getUnicornMessage());
-			else
-				messages.add(new Message(Message.ERROR, ucnException.getMessage(), null));
+		} catch (final UnicornException e) {
+			if (e.getUnicornMessage() != null)
+				messages.add(e.getUnicornMessage());
+			else if (e.getMessage() != null)
+				messages.add(new Message(Message.ERROR, e.getMessage(), null));
 			aOutputModule.produceError(mapOfStringObject, resp.getWriter());
 		} catch (final Exception aException) {
 			logger.error("Exception : " + aException.getMessage(), aException);
Received on Friday, 9 October 2009 14:58:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:39 UTC