From 559cb7b8370a6a5359fe0bf3edeba649bad1be13 Mon Sep 17 00:00:00 2001 From: Thomas Scheffler Date: Tue, 19 Nov 2024 11:50:23 +0100 Subject: [PATCH] MCR-3224 activate PMD rule AvoidMessageDigestField --- .../datamodel/ifs/MCRContentInputStream.java | 17 +++++++++-------- ruleset.xml | 3 --- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/mycore-base/src/main/java/org/mycore/datamodel/ifs/MCRContentInputStream.java b/mycore-base/src/main/java/org/mycore/datamodel/ifs/MCRContentInputStream.java index 292ba78e3b..16448bd60f 100644 --- a/mycore-base/src/main/java/org/mycore/datamodel/ifs/MCRContentInputStream.java +++ b/mycore-base/src/main/java/org/mycore/datamodel/ifs/MCRContentInputStream.java @@ -35,7 +35,7 @@ * provides the header of the file that is read (the first 64k) for content type * detection purposes, counts the number of bytes read and builds an MD5 * checksum String while content goes through this input stream. - * + * * @author Frank Lützenkirchen */ public class MCRContentInputStream extends FilterInputStream { @@ -46,6 +46,7 @@ public class MCRContentInputStream extends FilterInputStream { protected byte[] md5 = null; /** The message digest to build the MD5 checksum */ + @SuppressWarnings("PMD.AvoidMessageDigestField") //InputStream is not thread safe either protected MessageDigest digest = null; /** The total number of bytes read so far */ @@ -56,7 +57,7 @@ public class MCRContentInputStream extends FilterInputStream { /** * Constructs a new MCRContentInputStream - * + * * @param in * the InputStream to read from * @throws MCRConfigurationException @@ -138,7 +139,7 @@ public int read(byte[] buf, int off, int len) throws IOException { /** * Returns the first 64 k of the underlying input stream. This is used for * content type detection during file import into MyCoRe. - * + * * @return the first 64 k of the input stream */ public byte[] getHeader() { @@ -147,7 +148,7 @@ public byte[] getHeader() { /** * Returns the number of bytes read so far - * + * * @return the number of bytes read */ public long getLength() { @@ -157,7 +158,7 @@ public long getLength() { /** * Returns the MD5 message digest that has been built during reading of the * underlying input stream. - * + * * @return the MD5 message digest checksum of all bytes that have been read */ public byte[] getMD5() { @@ -169,7 +170,7 @@ public byte[] getMD5() { /** * Returns the MD5 checksum as a String - * + * * @return the MD5 checksum as a String of hex digits */ public String getMD5String() { @@ -178,7 +179,7 @@ public String getMD5String() { /** * Given an MD5 message digest, returns the MD5 checksum as a String - * + * * @return the MD5 checksum as a String of hex digits */ public static String getMD5String(byte[] digest) { @@ -191,7 +192,7 @@ public static String getMD5String(byte[] digest) { /** * Builds a MessageDigest instance for MD5 checksum computation. - * + * * @throws MCRConfigurationException * if no java classes that support MD5 algorithm could be found */ diff --git a/ruleset.xml b/ruleset.xml index d05d363fd6..e5fcfa2fd5 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -17,10 +17,7 @@ - -