changeset 188:facfd8518367

[4] IllegalArgumentException: Underflow. Legitimate attempt to read 0 bytes lead to exception
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 14 Apr 2011 02:46:35 +0200
parents b8534ac8ac67
children e9d275fb0bc0
files src/org/tmatesoft/hg/internal/FilterDataAccess.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/FilterDataAccess.java	Thu Apr 14 01:11:40 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/FilterDataAccess.java	Thu Apr 14 02:46:35 2011 +0200
@@ -99,8 +99,11 @@
 
 	@Override
 	public void readBytes(byte[] b, int off, int len) throws IOException {
+		if (len == 0) {
+			return;
+		}
 		if (count <= 0 || len > count) {
-			throw new IllegalArgumentException("Underflow"); // XXX be descriptive
+			throw new IllegalArgumentException(String.format("Underflow. Bytes left: %d, asked to read %d", count, len));
 		}
 		if (count == length) {
 			dataAccess.seek(offset);