summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2008-02-12 12:17:32 +0000
committerRoman Kennke <roman@kennke.org>2008-02-12 12:17:32 +0000
commitd6eb5ba5f739900a8947990e17fd9de439e70711 (patch)
treed7ad298b5357f1f4420f39608ea5e9fcbabc2a27 /java
parent8f1dae2708d7197d8f9b8243725c13a98f11fe68 (diff)
downloadclasspath-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.java13
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);
}