diff src/org/tmatesoft/hg/internal/RevlogStream.java @ 300:650b45d290b1

Share range check code
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 17 Sep 2011 13:41:04 +0200
parents e7ca6f16d074
children 694ebabb5cb3
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogStream.java	Sat Sep 17 13:26:52 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/RevlogStream.java	Sat Sep 17 13:41:04 2011 +0200
@@ -27,6 +27,7 @@
 
 import org.tmatesoft.hg.core.HgBadStateException;
 import org.tmatesoft.hg.core.Nodeid;
+import org.tmatesoft.hg.repo.HgInternals;
 import org.tmatesoft.hg.repo.HgRepository;
 
 
@@ -204,15 +205,7 @@
 		if (start == TIP) {
 			start = indexSize - 1;
 		}
-		if (start < 0 || start >= indexSize) {
-			throw new IllegalArgumentException(String.format("Bad left range boundary %d in [0..%d]", start, indexSize-1));
-		}
-		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));
-		}
+		HgInternals.checkRevlogRange(start, end, indexSize-1);
 		// XXX may cache [start .. end] from index with a single read (pre-read)
 		
 		ReaderN1 r = new ReaderN1(needData, inspector);