diff src/org/tmatesoft/hg/internal/InflaterDataAccess.java @ 391:856517285256

Provide more details about exception
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 20 Feb 2012 03:32:52 +0100
parents 31f67be94e71
children fdc1db8f7f61
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/InflaterDataAccess.java	Thu Feb 16 16:08:51 2012 +0100
+++ b/src/org/tmatesoft/hg/internal/InflaterDataAccess.java	Mon Feb 20 03:32:52 2012 +0100
@@ -127,11 +127,12 @@
 	}
 	
 	@Override
-	public void skip(int bytes) throws IOException {
+	public void skip(final int bytesToSkip) throws IOException {
+		int bytes = bytesToSkip;
 		if (bytes < 0) {
 			bytes += decompressedPos;
 			if (bytes < 0) {
-				throw new IOException("Underflow. Rewind past start of the slice.");
+				throw new IOException(String.format("Underflow. Rewind past start of the slice. To skip:%d, decPos:%d, decLen:%d. Left:%d", bytesToSkip, decompressedPos, decompressedLength, bytes));
 			}
 			reset();
 			// fall-through
@@ -141,7 +142,7 @@
 			bytes--;
 		}
 		if (bytes != 0) {
-			throw new IOException("Underflow. Rewind past end of the slice");
+			throw new IOException(String.format("Underflow. Rewind past end of the slice. To skip:%d, decPos:%d, decLen:%d. Left:%d", bytesToSkip, decompressedPos, decompressedLength, bytes));
 		}
 	}