From 31ac94c7115284a11144d03bac80e68fc2f34aaa Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 7 Jul 2004 08:54:30 +0000 Subject: [PATCH] fixed some heinous stream bugs darcs-hash:20040707085430-5007d-e4acbb1bd44544998525e79ffbce8a78721ad1a4.gz --- src/org/ibex/mail/protocol/IMAP.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) { -- 1.7.10.4