Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/DigestHelper.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 | 0a2f445de774 |
children | 9c9c442b5f2e |
comparison
equal
deleted
inserted
replaced
294:32890bab7209 | 295:981f9f50bb6c |
---|---|
19 import java.io.IOException; | 19 import java.io.IOException; |
20 import java.io.InputStream; | 20 import java.io.InputStream; |
21 import java.security.MessageDigest; | 21 import java.security.MessageDigest; |
22 import java.security.NoSuchAlgorithmException; | 22 import java.security.NoSuchAlgorithmException; |
23 | 23 |
24 import org.tmatesoft.hg.core.HgBadStateException; | |
24 import org.tmatesoft.hg.core.Nodeid; | 25 import org.tmatesoft.hg.core.Nodeid; |
25 | 26 |
26 | 27 |
27 /** | 28 /** |
28 * <pre> | 29 * <pre> |
47 if (sha1 == null) { | 48 if (sha1 == null) { |
48 try { | 49 try { |
49 sha1 = MessageDigest.getInstance("SHA-1"); | 50 sha1 = MessageDigest.getInstance("SHA-1"); |
50 } catch (NoSuchAlgorithmException ex) { | 51 } catch (NoSuchAlgorithmException ex) { |
51 // could hardly happen, JDK from Sun always has sha1. | 52 // could hardly happen, JDK from Sun always has sha1. |
52 ex.printStackTrace(); // FIXME log error | 53 throw new HgBadStateException(ex); |
53 } | 54 } |
54 } | 55 } |
55 return sha1; | 56 return sha1; |
56 } | 57 } |
57 | 58 |