]> source.dussan.org Git - jgit.git/commitdiff
Use readFully() instead of read() 20/1820/1
authorRobin Stocker <robin@nibor.org>
Fri, 29 Oct 2010 12:52:52 +0000 (14:52 +0200)
committerRobin Stocker <robin@nibor.org>
Fri, 29 Oct 2010 12:52:52 +0000 (14:52 +0200)
Fixes the "Method ignores results of InputStream.read()" warning.

This is the only place where read() was used instead of readFully()
and the return value was not checked. So it was either an oversight
or should be documented. This change assumes it was an oversight.

Change-Id: I859404a7d80449c538a552427787f3e57d7c92b4

org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java

index 2bf0b96f6ba0664d9c8bfbf1e6b6b8bc44e7ca0e..fef38ccac09d2da0e7fd8c7c8604d2d84bbe9c6d 100644 (file)
@@ -599,7 +599,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
                                        JGitText.get().packObjectCountMismatch, packCnt, idx.getObjectCount(), getPackFile()));
 
                fd.seek(length - 20);
-               fd.read(buf, 0, 20);
+               fd.readFully(buf, 0, 20);
                if (!Arrays.equals(buf, packChecksum))
                        throw new PackMismatchException(MessageFormat.format(
                                        JGitText.get().packObjectCountMismatch