summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ChangeLog6
-rw-r--r--java/awt/color/ICC_Profile.java13
2 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7790afe64..36b218cf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2008-02-10 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/remote/NotificationResult.java:
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);
}