Mercurial > jhg
changeset 391:856517285256
Provide more details about exception
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 20 Feb 2012 03:32:52 +0100 |
parents | 6952d9ce97f1 |
children | 656a6c1346ff |
files | src/org/tmatesoft/hg/core/HgInvalidFileException.java src/org/tmatesoft/hg/internal/InflaterDataAccess.java |
diffstat | 2 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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"); + } + } + } }
--- 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)); } }