# HG changeset patch # User Artem Tikhomirov # Date 1316213314 -7200 # Node ID e7ca6f16d0748633af55c2b647465e16bd3abaa9 # Parent 02f2963c70fa877d2a01d4808e1d9f88657bf1d2 Better message for incorrect range requested diff -r 02f2963c70fa -r e7ca6f16d074 src/org/tmatesoft/hg/internal/RevlogStream.java --- 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 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 patch) throws IOException {