tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 InputBuffer.java
Date Sun, 05 Jan 2003 17:20:41 GMT
remm        2003/01/05 09:20:41

  Modified:    coyote/src/java/org/apache/coyote/tomcat5 InputBuffer.java
  Log:
  - Fix skip and reset.
  
  Revision  Changes    Path
  1.3       +14 -9     jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/InputBuffer.java
  
  Index: InputBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/InputBuffer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InputBuffer.java	5 Jan 2003 13:26:39 -0000	1.2
  +++ InputBuffer.java	5 Jan 2003 17:20:41 -0000	1.3
  @@ -413,13 +413,19 @@
   
           long nRead = 0;
           while (nRead < n) {
  -            if (cb.getLength() > n) {
  +            if (cb.getLength() >= n) {
                   cb.setOffset(cb.getStart() + (int) n);
                   nRead = n;
               } else {
                   nRead += cb.getLength();
                   cb.setOffset(cb.getEnd());
  -                int nb = realReadChars(cb.getChars(), 0, cb.getEnd());
  +                int toRead = 0;
  +                if (cb.getChars().length < (n - nRead)) {
  +                    toRead = cb.getChars().length;
  +                } else {
  +                    toRead = (int) (n - nRead);
  +                }
  +                int nb = realReadChars(cb.getChars(), 0, toRead);
                   if (nb < 0)
                       break;
               }
  @@ -450,19 +456,18 @@
   
       public void reset()
           throws IOException {
  -        bb.recycle();
           if (state == CHAR_STATE) {
               if (markPos < 0) {
                   cb.recycle();
                   markPos = -1;
  -                throw new IOException("Mark not set"); //FIXME: i18n
  +                throw new IOException();
  +            } else {
  +                cb.setOffset(markPos);
  +                markPos = -1;
               }
  +        } else {
  +            bb.recycle();
           }
  -        /*
  -        cb.recycle();
  -        gotEnc = false;
  -        enc = null;
  -        */
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message