One of our engineers found an interesting bug that may have been 
causing jservs to crash.

Apparently, HttpUtils.parseQueryString() can throw a 
StringIndexOutOfBoundsException while parsing a query string. This 
occurs when the query string has a '%' as one of the last two 
characters. Normally a uri would have two characters after a % which 
are the hex value for the character that is encoded, but it seems 
that bad uri's happen and we shouldn't have jvm's dying because of 
them.

Here is the change which I'll check in today after I hear some votes 
to the affirmative.


Bernie



RCS file: 
/products/cvs/master/jserv/src/java/org/apache/jserv/JServConnection.j 
ava,v
retrieving revision 1.74
diff -u -r1.74 JServConnection.java
--- src/java/org/apache/jserv/JServConnection.java      1999/12/28 
18:38:23     1.74
+++ src/java/org/apache/jserv/JServConnection.java      2000/03/15 16:33:14
@@ -719,6 +719,8 @@
              queryParameters = HttpUtils.parseQueryString(getQueryString());
          } catch (IllegalArgumentException e) {
              queryParameters = null;
+        } catch (StringIndexOutOfBoundsException e) {
+            queryParameters = null;
          }
 
          // Parse any posted parameters in the input stream
Index: src/java/org/apache/jserv/JServServletManager.java
===================================================================
RCS file: 
/products/cvs/master/jserv/src/java/org/apache/jserv/JServServletManag 
er.java,v
retrieving revision 1.51
diff -u -r1.51 JServServletManager.java
--- src/java/org/apache/jserv/JServServletManager.java  1999/10/04 
17:13:12     1.51
+++ src/java/org/apache/jserv/JServServletManager.java  2000/03/15 16:33:14
@@ -756,6 +756,8 @@
              }
          } catch (IllegalArgumentException badquerystr) {
              return null;
+        } catch (StringIndexOutOfBoundsException badquerystr) {
+            return null;
          }
      }
Bernie Bernstein
Talk City Inc.
voice: 408-871-5320                   Join the Conversation.
email: [EMAIL PROTECTED]      http://www.talkcity.com/


--
----------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to