geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol PacketInputStream.java PacketOutputStream.java
Date Sat, 20 Mar 2004 20:39:11 GMT
adc         2004/03/20 12:39:11

  Modified:    modules/network/src/java/org/apache/geronimo/network/protocol
                        PacketInputStream.java PacketOutputStream.java
  Log:
  Simplifying the code a bit removes a bug.
  
  Revision  Changes    Path
  1.2       +2 -4      incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/PacketInputStream.java
  
  Index: PacketInputStream.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/PacketInputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PacketInputStream.java	18 Mar 2004 04:05:27 -0000	1.1
  +++ PacketInputStream.java	20 Mar 2004 20:39:11 -0000	1.2
  @@ -45,7 +45,7 @@
           this.closed = false;
   
           this.up.setUpProtocol(buffer);
  -        buffer.setDownProtocol(up);
  +        buffer.setDownProtocol(this.up);
   
       }
   
  @@ -67,8 +67,6 @@
           } else if ((off < 0) || (off > b.length) || (len < 0) ||
                   ((off + len) > b.length) || ((off + len) < 0)) {
               throw new IndexOutOfBoundsException();
  -        } else if (len == 0) {
  -            return 0;
           }
   
           int length = len;
  
  
  
  1.2       +9 -14     incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/PacketOutputStream.java
  
  Index: PacketOutputStream.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/PacketOutputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PacketOutputStream.java	18 Mar 2004 04:05:27 -0000	1.1
  +++ PacketOutputStream.java	20 Mar 2004 20:39:11 -0000	1.2
  @@ -69,20 +69,15 @@
           } else if ((off < 0) || (off > b.length) || (len < 0) ||
                   ((off + len) > b.length) || ((off + len) < 0)) {
               throw new IndexOutOfBoundsException();
  -        } else if (len == 0) {
  -            return;
           }
  -        if (currentBuffer.remaining() <= len) {
  -            while (len > 0) {
  -                int remaining = currentBuffer.remaining();
  -                int segment = Math.min(remaining, len);
  -                currentBuffer.put(b, off, segment);
  -                off += segment;
  -                len -= remaining;
  -                if (!currentBuffer.hasRemaining()) flush();
  -            }
  -        } else {
  -            currentBuffer.put(b, off, len);
  +
  +        while (len > 0) {
  +            int remaining = currentBuffer.remaining();
  +            int segment = Math.min(remaining, len);
  +            currentBuffer.put(b, off, segment);
  +            off += segment;
  +            len -= remaining;
  +            if (!currentBuffer.hasRemaining()) flush();
           }
       }
   
  
  
  

Mime
View raw message