From daf1f35793c8fb17850579d24fd6d18a3c1e1249 Mon Sep 17 00:00:00 2001 From: "A. Abram White" Date: Tue, 15 Aug 2006 16:16:57 +0000 Subject: [PATCH] Marc correctly pointed out that FileInputStream.read() isn't guaranteed to read all available data into the given buffer in one call. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@431635 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java index 168012cd3..8355e72a1 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/FileMetaDataIterator.java @@ -147,7 +147,8 @@ public class FileMetaDataIterator implements MetaDataIterator { content = bout.toByteArray(); } else { content = new byte[(int) len]; - fin.read(content); + for (int r, o = 0; o < content.length && (r = fin. + read(content, o, content.length - o)) != -1; o += r); } return content; } finally {