chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r767295 - in /hadoop/chukwa: branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/XssFilter.java trunk/src/java/org/apache/hadoop/chukwa/util/XssFilter.java
Date Tue, 21 Apr 2009 21:12:11 GMT
Author: eyang
Date: Tue Apr 21 21:12:10 2009
New Revision: 767295

URL: http://svn.apache.org/viewvc?rev=767295&view=rev
Log:
CHUKWA-166.  Handle null parameter case for XSSFilter. (Terence Kwan via Eric Yang)


Modified:
    hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/XssFilter.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/XssFilter.java

Modified: hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/XssFilter.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/XssFilter.java?rev=767295&r1=767294&r2=767295&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/XssFilter.java
(original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/XssFilter.java
Tue Apr 21 21:12:10 2009
@@ -8,8 +8,9 @@
 import com.josephoconnell.html.HTMLInputFilter;
 
 public class XssFilter {
-  private HttpServletRequest request = null;
-  private static Log log = LogFactory.getLog(XssFilter.class);
+    private HttpServletRequest request = null;
+    private static Log log = LogFactory.getLog(XssFilter.class);
+    
     public XssFilter() {
     }
 
@@ -18,15 +19,26 @@
     }
     
     public String getParameter(String key) {
-      return filter(this.request.getParameter(key));
+	String value=null;
+	try {
+	    value=this.request.getParameter(key);  
+	} catch (Exception e) {
+	    log.info("XssFilter.getParameter: Cannot get parameter for: "+key);
+	}
+	return filter(value);
     }
     
     public String[] getParameterValues(String key) {
-      String[] values = this.request.getParameterValues(key);
-      if(values!=null) {
-        for(int i=0;i<values.length;i++) {
-          values[i] = filter(values[i]);
-        }
+      String[] values=null;
+      try {
+	  values  = this.request.getParameterValues(key);
+	  if(values!=null) {
+	      for(int i=0;i<values.length;i++) {
+		  values[i] = filter(values[i]);
+	      }
+	  }
+      } catch (Exception e) {
+	  log.info("XssFilter.getParameterValues: cannot get parameter for: "+key);
       }
       return values;
     }

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/XssFilter.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/XssFilter.java?rev=767295&r1=767294&r2=767295&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/XssFilter.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/XssFilter.java Tue Apr 21 21:12:10
2009
@@ -8,8 +8,9 @@
 import com.josephoconnell.html.HTMLInputFilter;
 
 public class XssFilter {
-  private HttpServletRequest request = null;
-  private static Log log = LogFactory.getLog(XssFilter.class);
+    private HttpServletRequest request = null;
+    private static Log log = LogFactory.getLog(XssFilter.class);
+    
     public XssFilter() {
     }
 
@@ -18,15 +19,26 @@
     }
     
     public String getParameter(String key) {
-      return filter(this.request.getParameter(key));
+	String value=null;
+	try {
+	    value=this.request.getParameter(key);  
+	} catch (Exception e) {
+	    log.info("XssFilter.getParameter: Cannot get parameter for: "+key);
+	}
+	return filter(value);
     }
     
     public String[] getParameterValues(String key) {
-      String[] values = this.request.getParameterValues(key);
-      if(values!=null) {
-        for(int i=0;i<values.length;i++) {
-          values[i] = filter(values[i]);
-        }
+      String[] values=null;
+      try {
+	  values  = this.request.getParameterValues(key);
+	  if(values!=null) {
+	      for(int i=0;i<values.length;i++) {
+		  values[i] = filter(values[i]);
+	      }
+	  }
+      } catch (Exception e) {
+	  log.info("XssFilter.getParameterValues: cannot get parameter for: "+key);
       }
       return values;
     }



Mime
View raw message