diff src/org/tmatesoft/hg/internal/DigestHelper.java @ 423:9c9c442b5f2e

Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 23 Mar 2012 22:51:18 +0100
parents 981f9f50bb6c
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/DigestHelper.java	Fri Mar 23 21:26:01 2012 +0100
+++ b/src/org/tmatesoft/hg/internal/DigestHelper.java	Fri Mar 23 22:51:18 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2011 TMate Software Ltd
+ * Copyright (c) 2010-2012 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,8 +21,8 @@
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
-import org.tmatesoft.hg.core.HgBadStateException;
 import org.tmatesoft.hg.core.Nodeid;
+import org.tmatesoft.hg.repo.HgInvalidStateException;
 
 
 /**
@@ -50,7 +50,9 @@
 				sha1 = MessageDigest.getInstance("SHA-1");
 			} catch (NoSuchAlgorithmException ex) {
 				// could hardly happen, JDK from Sun always has sha1.
-				throw new HgBadStateException(ex);
+				HgInvalidStateException t = new HgInvalidStateException("Need SHA-1 algorithm for nodeid calculation");
+				t.initCause(ex);
+				throw t;
 			}
 		}
 		return sha1;