diff src/org/tmatesoft/hg/internal/RevlogStream.java @ 297:e7ca6f16d074

Better message for incorrect range requested
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 17 Sep 2011 00:48:34 +0200
parents 981f9f50bb6c
children 650b45d290b1
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogStream.java	Fri Sep 16 21:00:29 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/RevlogStream.java	Sat Sep 17 00:48:34 2011 +0200
@@ -207,9 +207,12 @@
 		if (start < 0 || start >= indexSize) {
 			throw new IllegalArgumentException(String.format("Bad left range boundary %d in [0..%d]", start, indexSize-1));
 		}
-		if (end < start || end >= indexSize) {
+		if (end >= indexSize) {
 			throw new IllegalArgumentException(String.format("Bad right range boundary %d in [0..%d]", end, indexSize-1));
 		}
+		if (end < start) {
+			throw new IllegalArgumentException(String.format("Bad range [%d..%d]", start, end));
+		}
 		// XXX may cache [start .. end] from index with a single read (pre-read)
 		
 		ReaderN1 r = new ReaderN1(needData, inspector);
@@ -521,15 +524,6 @@
 	}
 
 	
-	private static int[] toArray(List<Integer> l) {
-		int[] rv = new int[l.size()];
-		for (int i = 0; i < rv.length; i++) {
-			rv[i] = l.get(i);
-		}
-		return rv;
-	}
-	
-
 	// mpatch.c : apply()
 	// FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF
 	public/*for HgBundle; until moved to better place*/static byte[] apply(DataAccess baseRevisionContent, int outcomeLen, List<PatchRecord> patch) throws IOException {