diff options
author | Mykola Nikishov | 2016-12-18 09:42:49 +0000 |
---|---|---|
committer | Pascal Rapicault | 2017-03-29 14:14:30 +0000 |
commit | f6f9c5732002a7bbe4a692eb55449e5c00002cbe (patch) | |
tree | ca0a4a0cfe66b04739a43cb0cd275da3adf99695 /bundles/org.eclipse.equinox.p2.repository/src | |
parent | 7c9545086de9dda759cf3bc776ef4046513540b8 (diff) | |
download | rt.equinox.p2-f6f9c5732002a7bbe4a692eb55449e5c00002cbe.tar.gz rt.equinox.p2-f6f9c5732002a7bbe4a692eb55449e5c00002cbe.tar.xz rt.equinox.p2-f6f9c5732002a7bbe4a692eb55449e5c00002cbe.zip |
Bug 509401 - Don't hide I/O problems in ChecksumProducer's computeMD5(File)
If caller doesn't care about I/O problems during checksum calculation,
neither should computeMD5 method.
The only two callers, RecreateRepositoryApplication and PublisherHelper,
now catch such exceptions (to preserve original behavior) and log them
to make troubleshooting easier.
Change-Id: I1e82ac45cc958f4ffc3ed969a50cfa68aec3c8fc
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository/src')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumProducer.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumProducer.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumProducer.java index 4296a53fa..fc8cabec6 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumProducer.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumProducer.java @@ -18,9 +18,12 @@ import java.security.NoSuchAlgorithmException; public class ChecksumProducer { - public static String computeMD5(File file) { - if (file == null || file.isDirectory() || !file.exists()) - return null; + /** + * @param file should not be <code>null</code> + * @return MD5 checksum of the file or <code>null</code> in case of NoSuchAlgorithmException + * @throws IOException + */ + public static String computeMD5(File file) throws IOException { InputStream fis = null; try { MessageDigest md5Checker = MessageDigest.getInstance("MD5"); //$NON-NLS-1$ @@ -41,8 +44,6 @@ public class ChecksumProducer { return buf.toString(); } catch (NoSuchAlgorithmException e) { return null; - } catch (IOException e) { - return null; } finally { if (fis != null) try { |