diff src/org/tmatesoft/hg/core/HgStatus.java @ 628:6526d8adbc0f

Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 22 May 2013 15:52:31 +0200
parents 31a89587eb04
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgStatus.java	Tue May 21 20:17:33 2013 +0200
+++ b/src/org/tmatesoft/hg/core/HgStatus.java	Wed May 22 15:52:31 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012 TMate Software Ltd
+ * Copyright (c) 2011-2013 TMate Software Ltd
  *  
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
 
 import org.tmatesoft.hg.internal.ChangelogHelper;
 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
+import org.tmatesoft.hg.repo.HgRuntimeException;
 import org.tmatesoft.hg.util.Path;
 
 /**
@@ -70,8 +71,9 @@
 
 	/**
 	 * @return <code>null</code> if author for the change can't be deduced (e.g. for clean files it's senseless)
+	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
 	 */
-	public String getModificationAuthor() {
+	public String getModificationAuthor() throws HgRuntimeException {
 		RawChangeset cset = logHelper.findLatestChangeWith(path);
 		if (cset == null) {
 			if (kind == Kind.Modified || kind == Kind.Added || kind == Kind.Removed /*&& RightBoundary is TIP*/) {
@@ -84,15 +86,20 @@
 		return null;
 	}
 
-	public Date getModificationDate() {
+	/**
+	 * @return date when the file was last modified, never <code>null</code>. Either date of changeset the file was modified at
+	 * or timestamp of local file, if present
+	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
+	 */
+	public Date getModificationDate() throws HgRuntimeException {
 		RawChangeset cset = logHelper.findLatestChangeWith(path);
 		if (cset == null) {
 			File localFile = new File(logHelper.getRepo().getWorkingDir(), path.toString());
 			if (localFile.canRead()) {
 				return new Date(localFile.lastModified());
 			}
-			// TODO post-1.0 find out what to do in this case, perhaps, throw an exception?
-			// perhaps check dirstate and/or local file for tstamp
+			// TODO post-1.1 find out what to do in this case, perhaps, throw an exception?
+			// perhaps check dirstate and for timestamp
 			return new Date(); // what's correct? 
 		} else {
 			return cset.date();