# HG changeset patch # User Artem Tikhomirov # Date 1329705172 -3600 # Node ID 85651728525676c450f03531b45fbd9f90842356 # Parent 6952d9ce97f161924e1208cbd7bd02f66c69dbcb Provide more details about exception diff -r 6952d9ce97f1 -r 856517285256 src/org/tmatesoft/hg/core/HgInvalidFileException.java --- a/src/org/tmatesoft/hg/core/HgInvalidFileException.java Thu Feb 16 16:08:51 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgInvalidFileException.java Mon Feb 20 03:32:52 2012 +0100 @@ -59,4 +59,19 @@ public File getFile() { return localFile; } + + @Override + protected void appendDetails(StringBuilder sb) { + super.appendDetails(sb); + if (localFile != null) { + sb.append(" file:"); + sb.append(localFile.getPath()); + sb.append(','); + if (localFile.exists()) { + sb.append("EXISTS"); + } else { + sb.append("DOESN'T EXIST"); + } + } + } } diff -r 6952d9ce97f1 -r 856517285256 src/org/tmatesoft/hg/internal/InflaterDataAccess.java --- 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)); } }