diff options
author | Roman Kennke <roman@kennke.org> | 2008-02-12 12:17:32 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2008-02-12 12:17:32 +0000 |
commit | d6eb5ba5f739900a8947990e17fd9de439e70711 (patch) | |
tree | d7ad298b5357f1f4420f39608ea5e9fcbabc2a27 /java | |
parent | 8f1dae2708d7197d8f9b8243725c13a98f11fe68 (diff) | |
download | classpath-d6eb5ba5f739900a8947990e17fd9de439e70711.tar.gz |
2008-02-12 Roman Kennke <kennke@aicas.com>
* java/awt/color/ICC_Profile.java
(getInstance()): Wrap call to InputStream.read(byte[],int,int) in
a loop, in order to read the whole thing.
Diffstat (limited to 'java')
-rw-r--r-- | java/awt/color/ICC_Profile.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/java/awt/color/ICC_Profile.java b/java/awt/color/ICC_Profile.java index 1072cd694..e2efb3a89 100644 --- a/java/awt/color/ICC_Profile.java +++ b/java/awt/color/ICC_Profile.java @@ -426,10 +426,15 @@ public class ICC_Profile implements Serializable System.arraycopy(headerData, 0, data, 0, ProfileHeader.HEADERSIZE); // read the rest - if (in.read(data, ProfileHeader.HEADERSIZE, - header.getSize() - ProfileHeader.HEADERSIZE) != header.getSize() - - ProfileHeader.HEADERSIZE) - throw new IOException("Incorrect profile size"); + int totalBytes = header.getSize() - ProfileHeader.HEADERSIZE; + int bytesLeft = totalBytes; + while (bytesLeft > 0) + { + int read = in.read(data, + ProfileHeader.HEADERSIZE + (totalBytes - bytesLeft), + bytesLeft); + bytesLeft -= read; + } return getInstance(data); } |