You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by rg...@apache.org on 2010/02/22 00:21:11 UTC

svn commit: r912437 - /incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetKeyManager.java

Author: rgardler
Date: Sun Feb 21 23:21:11 2010
New Revision: 912437

URL: http://svn.apache.org/viewvc?rev=912437&view=rev
Log:
A couple of log messages about invalid API keys

Modified:
    incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetKeyManager.java

Modified: incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetKeyManager.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetKeyManager.java?rev=912437&r1=912436&r2=912437&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetKeyManager.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetKeyManager.java Sun Feb 21 23:21:11 2010
@@ -20,6 +20,7 @@
 import org.apache.commons.mail.Email;
 import org.apache.commons.mail.EmailException;
 import org.apache.commons.mail.SimpleEmail;
+import org.apache.log4j.Logger;
 
 import org.apache.wookie.Messages;
 import org.apache.wookie.beans.ApiKey;
@@ -32,6 +33,7 @@
  *
  */
 public class WidgetKeyManager{
+  static Logger _logger = Logger.getLogger(WidgetKeyManager.class.getName());
 	
 	/**
 	 * Revoke the given key
@@ -105,12 +107,18 @@
 	 */
 	public static boolean isValid(String key) {
 		// No key/n
-		if (key == null) return false;
+		if (key == null) {
+		  _logger.info("No API key supplied");
+		  return false;
+		}
 
 		// Empty key/empty origin
 		if (key.trim().equals("")) return false; //$NON-NLS-1$
 		ApiKey[] apiKey = ApiKey.findByValue("value", key);
-		if (apiKey == null || apiKey.length !=1) return false;
+		if (apiKey == null || apiKey.length !=1) {
+		  _logger.info("Invalid API key supplied: " + key);
+		  return false;
+		}
 		return true;
 	}