diff src/org/tmatesoft/hg/internal/RevlogStream.java @ 295:981f9f50bb6c

Issue 11: Error log facility. SessionContext to share common facilities
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Sep 2011 05:35:32 +0200
parents b11f6a08f748
children e7ca6f16d074
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogStream.java	Wed Sep 14 04:41:57 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/RevlogStream.java	Fri Sep 16 05:35:32 2011 +0200
@@ -79,6 +79,9 @@
 		return baseRevisions.length;
 	}
 	
+	/**
+	 * @throws HgBadStateException if internal read operation failed
+	 */
 	public int dataLength(int revision) {
 		// XXX in fact, use of iterate() instead of this implementation may be quite reasonable.
 		//
@@ -94,12 +97,15 @@
 			return actualLen; 
 		} catch (IOException ex) {
 			ex.printStackTrace(); // log error. FIXME better handling
-			throw new IllegalStateException(ex);
+			throw new HgBadStateException(ex);
 		} finally {
 			daIndex.done();
 		}
 	}
 	
+	/**
+	 * @throws HgBadStateException if internal read operation failed
+	 */
 	public byte[] nodeid(int revision) {
 		final int indexSize = revisionCount();
 		if (revision == TIP) {
@@ -117,12 +123,16 @@
 			return rv;
 		} catch (IOException ex) {
 			ex.printStackTrace();
-			throw new IllegalStateException();
+			throw new HgBadStateException();
 		} finally {
 			daIndex.done();
 		}
 	}
-	
+
+	/**
+	 * Get link field from the index record.
+	 * @throws HgBadStateException if internal read operation failed
+	 */
 	public int linkRevision(int revision) {
 		final int last = revisionCount() - 1;
 		if (revision == TIP) {
@@ -139,7 +149,7 @@
 			return linkRev;
 		} catch (IOException ex) {
 			ex.printStackTrace();
-			throw new IllegalStateException();
+			throw new HgBadStateException();
 		} finally {
 			daIndex.done();
 		}