From: adam Date: Wed, 7 Jul 2004 08:54:30 +0000 (+0000) Subject: fixed some heinous stream bugs X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=31ac94c7115284a11144d03bac80e68fc2f34aaa;p=org.ibex.mail.git fixed some heinous stream bugs darcs-hash:20040707085430-5007d-e4acbb1bd44544998525e79ffbce8a78721ad1a4.gz --- diff --git a/src/org/ibex/mail/protocol/IMAP.java b/src/org/ibex/mail/protocol/IMAP.java index 28cd51a..c82fd30 100644 --- a/src/org/ibex/mail/protocol/IMAP.java +++ b/src/org/ibex/mail/protocol/IMAP.java @@ -662,7 +662,12 @@ public class IMAP { while(stream.peekc() == ' ') stream.getc(); // whitespace while (stream.getc() != '\n' && stream.getc() != '\r') { } byte[] bytes = new byte[octets]; - stream.read(bytes, 0, bytes.length); + int numread = 0; + while(numread < bytes.length) { + int n = stream.read(bytes, numread, bytes.length - numread); + if (n == -1) bad("end of stream while reading IMAP qstring"); + numread += n; + } return new Token(new String(bytes), true); } else if (c == '\"') { while(true) {