changeset 168:dd525ca65de8

Stupid defect that cost me couple of hours. What a coincidence for merge revision of interest (157) to be right on the BIS buffer boundary.
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 22 Mar 2011 21:18:40 +0100
parents 86f9581f4301
children 8c8e3f372fa1
files src/org/tmatesoft/hg/internal/RevlogDump.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogDump.java	Tue Mar 22 03:52:34 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/RevlogDump.java	Tue Mar 22 21:18:40 2011 +0100
@@ -73,7 +73,10 @@
 			int parent2Revision = di.readInt();
 			byte[] buf = new byte[32];
 			di.readFully(buf, 12, 20);
-			dis.skip(12);
+			dis.skipBytes(12); 
+			// CAN'T USE skip() here without extra precautions. E.g. I ran into situation when 
+			// buffer was 8192 and BufferedInputStream was at position 8182 before attempt to skip(12). 
+			// BIS silently skips available bytes and leaves me two extra bytes that ruin the rest of the code.
 			System.out.printf("%4d:%14d %6X %10d %10d %10d %10d %8d %8d     %040x\n", entryCount, offset, flags, compressedLen, actualLen, baseRevision, linkRevision, parent1Revision, parent2Revision, new BigInteger(buf));
 			if (inlineData) {
 				String resultString;