Mercurial > hg4j
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 390:6952d9ce97f1 | 391:856517285256 |
|---|---|
| 125 skip((int) localOffset); | 125 skip((int) localOffset); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 @Override | 129 @Override |
| 130 public void skip(int bytes) throws IOException { | 130 public void skip(final int bytesToSkip) throws IOException { |
| 131 int bytes = bytesToSkip; | |
| 131 if (bytes < 0) { | 132 if (bytes < 0) { |
| 132 bytes += decompressedPos; | 133 bytes += decompressedPos; |
| 133 if (bytes < 0) { | 134 if (bytes < 0) { |
| 134 throw new IOException("Underflow. Rewind past start of the slice."); | 135 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)); |
| 135 } | 136 } |
| 136 reset(); | 137 reset(); |
| 137 // fall-through | 138 // fall-through |
| 138 } | 139 } |
| 139 while (!isEmpty() && bytes > 0) { | 140 while (!isEmpty() && bytes > 0) { |
| 140 readByte(); | 141 readByte(); |
| 141 bytes--; | 142 bytes--; |
| 142 } | 143 } |
| 143 if (bytes != 0) { | 144 if (bytes != 0) { |
| 144 throw new IOException("Underflow. Rewind past end of the slice"); | 145 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)); |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 @Override | 149 @Override |
| 149 public byte readByte() throws IOException { | 150 public byte readByte() throws IOException { |
