From 93aef7304c84e824c07b51a9c0d51f063cbbcadc Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sun, 10 Dec 2023 13:02:42 +0100 Subject: [PATCH] run javadoc:fix --- .../plexus/digest/AbstractDigester.java | 17 +++++++++ .../digest/AbstractStreamingDigester.java | 35 ++++++++++++++++++ .../codehaus/plexus/digest/ChecksumFile.java | 37 +++++++++---------- .../codehaus/plexus/digest/DigestUtils.java | 16 ++++++-- .../org/codehaus/plexus/digest/Digester.java | 9 +++-- .../plexus/digest/DigesterException.java | 21 +++++++++++ .../java/org/codehaus/plexus/digest/Hex.java | 15 +++++++- .../codehaus/plexus/digest/Md5Digester.java | 12 +++++- .../codehaus/plexus/digest/Sha1Digester.java | 10 ++++- .../plexus/digest/StreamingDigester.java | 7 ++-- .../plexus/digest/StreamingMd5Digester.java | 3 ++ .../plexus/digest/StreamingSha1Digester.java | 3 ++ 12 files changed, 151 insertions(+), 34 deletions(-) diff --git a/src/main/java/org/codehaus/plexus/digest/AbstractDigester.java b/src/main/java/org/codehaus/plexus/digest/AbstractDigester.java index a871fdb..2038133 100644 --- a/src/main/java/org/codehaus/plexus/digest/AbstractDigester.java +++ b/src/main/java/org/codehaus/plexus/digest/AbstractDigester.java @@ -33,16 +33,27 @@ public abstract class AbstractDigester { private final StreamingDigester streamingDigester; + /** + *

Constructor for AbstractDigester.

+ * + * @param streamingDigester a {@link org.codehaus.plexus.digest.StreamingDigester} object. + */ protected AbstractDigester( StreamingDigester streamingDigester ) { this.streamingDigester = streamingDigester; } + /** + *

getAlgorithm.

+ * + * @return a {@link java.lang.String} object. + */ public String getAlgorithm() { return streamingDigester.getAlgorithm(); } + /** {@inheritDoc} */ public String calc( File file ) throws DigesterException { @@ -65,6 +76,7 @@ public String calc( File file ) } } + /** {@inheritDoc} */ public void verify( File file, String checksum ) throws DigesterException { @@ -79,6 +91,11 @@ public void verify( File file, String checksum ) } } + /** + *

toString.

+ * + * @return a {@link java.lang.String} object. + */ public String toString() { return "[Digester:" + streamingDigester.getAlgorithm() + "]"; diff --git a/src/main/java/org/codehaus/plexus/digest/AbstractStreamingDigester.java b/src/main/java/org/codehaus/plexus/digest/AbstractStreamingDigester.java index b07f16c..b493a4e 100644 --- a/src/main/java/org/codehaus/plexus/digest/AbstractStreamingDigester.java +++ b/src/main/java/org/codehaus/plexus/digest/AbstractStreamingDigester.java @@ -33,6 +33,11 @@ public abstract class AbstractStreamingDigester private static final int BUFFER_SIZE = 32768; + /** + *

Constructor for AbstractStreamingDigester.

+ * + * @param algorithm a {@link java.lang.String} object. + */ protected AbstractStreamingDigester( String algorithm ) { try @@ -46,34 +51,64 @@ protected AbstractStreamingDigester( String algorithm ) } } + /** + *

getAlgorithm.

+ * + * @return a {@link java.lang.String} object. + */ public String getAlgorithm() { return md.getAlgorithm(); } + /** + *

calc.

+ * + * @return a {@link java.lang.String} object. + * @throws org.codehaus.plexus.digest.DigesterException if any. + */ public String calc() throws DigesterException { return calc( this.md ); } + /** + *

reset.

+ * + * @throws org.codehaus.plexus.digest.DigesterException if any. + */ public void reset() throws DigesterException { md.reset(); } + /** {@inheritDoc} */ public void update( InputStream is ) throws DigesterException { update( is, md ); } + /** + *

calc.

+ * + * @param md a {@link java.security.MessageDigest} object. + * @return a {@link java.lang.String} object. + */ protected static String calc( MessageDigest md ) { return Hex.encode( md.digest() ); } + /** + *

update.

+ * + * @param is a {@link java.io.InputStream} object. + * @param digest a {@link java.security.MessageDigest} object. + * @throws org.codehaus.plexus.digest.DigesterException if any. + */ protected static void update( InputStream is, MessageDigest digest ) throws DigesterException { diff --git a/src/main/java/org/codehaus/plexus/digest/ChecksumFile.java b/src/main/java/org/codehaus/plexus/digest/ChecksumFile.java index 15588c1..e3cff00 100644 --- a/src/main/java/org/codehaus/plexus/digest/ChecksumFile.java +++ b/src/main/java/org/codehaus/plexus/digest/ChecksumFile.java @@ -24,11 +24,10 @@ import java.io.IOException; /** - * ChecksumFile + * ChecksumFile * * @author Joakim Erdfelt * @version $Id$ - * * @plexus.component role="org.codehaus.plexus.digest.ChecksumFile" */ public class ChecksumFile @@ -47,27 +46,27 @@ public class ChecksumFile *

* Given a checksum file, check to see if the file it represents is valid according to the checksum. *

- * - *
- * Terminology: - *
Checksum File
- *
The file that contains the previously calculated checksum value for the reference file. + * + *

+ *

Terminology:

+ *

Checksum File

+ *

The file that contains the previously calculated checksum value for the reference file. * This is a text file with the extension ".sha1" or ".md5", and contains a single entry * consisting of an optional reference filename, and a checksum string. - *

- *
Reference File
- *
The file that is being referenced in the checksum file.
- *
- * + *

+ *

Reference File

+ *

The file that is being referenced in the checksum file.

+ *

+ * *

* NOTE: Only supports single file checksums of type MD5 or SHA1. *

- * + * * @param checksumFile the checksum file (must end in ".sha1" or ".md5") * @return true if the checksum is valid for the file it represents. - * @throws DigesterException if there is a digester problem during the check of the reference file. - * @throws FileNotFoundException if the checksumFile itself or the file it refers to is not found. - * @throws IOException if the reading of the checksumFile or the file it refers to fails. + * @throws org.codehaus.plexus.digest.DigesterException if there is a digester problem during the check of the reference file. + * @throws java.io.FileNotFoundException if the checksumFile itself or the file it refers to is not found. + * @throws java.io.IOException if the reading of the checksumFile or the file it refers to fails. */ public boolean isValidChecksum( File checksumFile ) throws DigesterException, FileNotFoundException, IOException { @@ -111,12 +110,12 @@ else if ( path.endsWith( digestSha1.getFilenameExtension() ) ) /** * Creates a checksum file of the provided referenceFile. - * + * * @param referenceFile the file to checksum. * @param digester the digester to use. * @return the checksum File that was created. - * @throws DigesterException if there was a problem calculating the checksum of the referenceFile. - * @throws IOException if there was a problem either reading the referenceFile, or writing the checksum file. + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem calculating the checksum of the referenceFile. + * @throws java.io.IOException if there was a problem either reading the referenceFile, or writing the checksum file. */ public File createChecksum( File referenceFile, Digester digester ) throws DigesterException, IOException { diff --git a/src/main/java/org/codehaus/plexus/digest/DigestUtils.java b/src/main/java/org/codehaus/plexus/digest/DigestUtils.java index a54a8c0..265146a 100644 --- a/src/main/java/org/codehaus/plexus/digest/DigestUtils.java +++ b/src/main/java/org/codehaus/plexus/digest/DigestUtils.java @@ -30,21 +30,31 @@ private DigestUtils() { // don't create this class } - + /** * Take a raw checksum string and verify that it matches the expectedFilename and digester, then * return the trimmed checksum string. - * + * * @param rawChecksum the raw checksum string that may include the filename. * @param digester the expected digester for this checksum string. * @return the trimmed checksum string (no filename portion) - * @throws DigesterException if there was a problem verifying the checksum string. + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem verifying the checksum string. + * @param expectedFilename a {@link java.lang.String} object. */ public static String cleanChecksum( String rawChecksum, Digester digester, String expectedFilename ) throws DigesterException { return cleanChecksum( rawChecksum, digester.getAlgorithm(), expectedFilename ); } + /** + *

cleanChecksum.

+ * + * @param checksum a {@link java.lang.String} object. + * @param algorithm a {@link java.lang.String} object. + * @param path a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + * @throws org.codehaus.plexus.digest.DigesterException if any. + */ public static String cleanChecksum( String checksum, String algorithm, String path ) throws DigesterException { diff --git a/src/main/java/org/codehaus/plexus/digest/Digester.java b/src/main/java/org/codehaus/plexus/digest/Digester.java index 9ea3669..819d47f 100644 --- a/src/main/java/org/codehaus/plexus/digest/Digester.java +++ b/src/main/java/org/codehaus/plexus/digest/Digester.java @@ -25,6 +25,7 @@ */ public interface Digester { + /** Constant ROLE="Digester.class.getName()" */ String ROLE = Digester.class.getName(); /** @@ -33,10 +34,10 @@ public interface Digester * @return the algorithm */ String getAlgorithm(); - + /** * The filename extension for this digester. - * + * * @return the filename extension. */ String getFilenameExtension(); @@ -46,7 +47,7 @@ public interface Digester * * @param file the file to calculate the checksum for * @return the current checksum. - * @throws DigesterException if there was a problem computing the hashcode. + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem computing the hashcode. */ String calc( File file ) throws DigesterException; @@ -56,7 +57,7 @@ String calc( File file ) * * @param file the file to compute the checksum for * @param checksum the checksum to compare to - * @throws DigesterException if there was a problem computing the hashcode. + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem computing the hashcode. */ void verify( File file, String checksum ) throws DigesterException; diff --git a/src/main/java/org/codehaus/plexus/digest/DigesterException.java b/src/main/java/org/codehaus/plexus/digest/DigesterException.java index 2cfa531..3a4f8b4 100644 --- a/src/main/java/org/codehaus/plexus/digest/DigesterException.java +++ b/src/main/java/org/codehaus/plexus/digest/DigesterException.java @@ -17,26 +17,47 @@ */ /** + *

DigesterException class.

+ * * @author Edwin Punzalan */ public class DigesterException extends Exception { + /** + *

Constructor for DigesterException.

+ */ public DigesterException() { super(); } + /** + *

Constructor for DigesterException.

+ * + * @param message a {@link java.lang.String} object. + */ public DigesterException( String message ) { super( message ); } + /** + *

Constructor for DigesterException.

+ * + * @param message a {@link java.lang.String} object. + * @param cause a {@link java.lang.Throwable} object. + */ public DigesterException( String message, Throwable cause ) { super( message, cause ); } + /** + *

Constructor for DigesterException.

+ * + * @param cause a {@link java.lang.Throwable} object. + */ public DigesterException( Throwable cause ) { super( cause ); diff --git a/src/main/java/org/codehaus/plexus/digest/Hex.java b/src/main/java/org/codehaus/plexus/digest/Hex.java index 923d007..3eaae00 100644 --- a/src/main/java/org/codehaus/plexus/digest/Hex.java +++ b/src/main/java/org/codehaus/plexus/digest/Hex.java @@ -17,14 +17,19 @@ */ /** - * Hex - simple hex conversions. + * Hex - simple hex conversions. * - * @version $Id$ */ public class Hex { private static final byte[] DIGITS = "0123456789abcdef".getBytes(); + /** + *

encode.

+ * + * @param data an array of {@link byte} objects. + * @return a {@link java.lang.String} object. + */ public static String encode( byte[] data ) { int l = data.length; @@ -40,6 +45,12 @@ public static String encode( byte[] data ) return new String( raw ); } + /** + *

encode.

+ * + * @param raw a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + */ public static String encode( String raw ) { return encode( raw.getBytes() ); diff --git a/src/main/java/org/codehaus/plexus/digest/Md5Digester.java b/src/main/java/org/codehaus/plexus/digest/Md5Digester.java index 053c65c..d3954dd 100644 --- a/src/main/java/org/codehaus/plexus/digest/Md5Digester.java +++ b/src/main/java/org/codehaus/plexus/digest/Md5Digester.java @@ -18,17 +18,25 @@ /** * Digester that does MD5 Message Digesting Only. - * + * * @plexus.component role="org.codehaus.plexus.digest.Digester" role-hint="md5" */ public class Md5Digester extends AbstractDigester { + /** + *

getFilenameExtension.

+ * + * @return a {@link java.lang.String} object. + */ public String getFilenameExtension() { return ".md5"; } - + + /** + *

Constructor for Md5Digester.

+ */ public Md5Digester() { super( new StreamingMd5Digester() ); diff --git a/src/main/java/org/codehaus/plexus/digest/Sha1Digester.java b/src/main/java/org/codehaus/plexus/digest/Sha1Digester.java index c18646b..a0cfdfe 100644 --- a/src/main/java/org/codehaus/plexus/digest/Sha1Digester.java +++ b/src/main/java/org/codehaus/plexus/digest/Sha1Digester.java @@ -24,11 +24,19 @@ public class Sha1Digester extends AbstractDigester { + /** + *

getFilenameExtension.

+ * + * @return a {@link java.lang.String} object. + */ public String getFilenameExtension() { return ".sha1"; } - + + /** + *

Constructor for Sha1Digester.

+ */ public Sha1Digester() { super( new StreamingSha1Digester() ); diff --git a/src/main/java/org/codehaus/plexus/digest/StreamingDigester.java b/src/main/java/org/codehaus/plexus/digest/StreamingDigester.java index df9d5d7..acb0959 100644 --- a/src/main/java/org/codehaus/plexus/digest/StreamingDigester.java +++ b/src/main/java/org/codehaus/plexus/digest/StreamingDigester.java @@ -25,6 +25,7 @@ */ public interface StreamingDigester { + /** Constant ROLE="StreamingDigester.class.getName()" */ String ROLE = StreamingDigester.class.getName(); /** @@ -38,7 +39,7 @@ public interface StreamingDigester * Reset the hashcode calculation algorithm. * Only useful when performing incremental hashcodes based on repeated use of {@link #update(InputStream)} * - * @throws DigesterException if there was a problem with the internal message digest + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem with the internal message digest */ void reset() throws DigesterException; @@ -47,7 +48,7 @@ void reset() * Calculate the current checksum. * * @return the current checksum. - * @throws DigesterException if there was a problem computing the hashcode. + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem computing the hashcode. */ String calc() throws DigesterException; @@ -56,7 +57,7 @@ String calc() * Update the checksum with the content of the input stream. * * @param is the input stream - * @throws DigesterException if there was a problem computing the hashcode. + * @throws org.codehaus.plexus.digest.DigesterException if there was a problem computing the hashcode. */ void update( InputStream is ) throws DigesterException; diff --git a/src/main/java/org/codehaus/plexus/digest/StreamingMd5Digester.java b/src/main/java/org/codehaus/plexus/digest/StreamingMd5Digester.java index e078d06..5ab3bf5 100644 --- a/src/main/java/org/codehaus/plexus/digest/StreamingMd5Digester.java +++ b/src/main/java/org/codehaus/plexus/digest/StreamingMd5Digester.java @@ -25,6 +25,9 @@ public class StreamingMd5Digester extends AbstractStreamingDigester { + /** + *

Constructor for StreamingMd5Digester.

+ */ public StreamingMd5Digester() { super( "MD5" ); diff --git a/src/main/java/org/codehaus/plexus/digest/StreamingSha1Digester.java b/src/main/java/org/codehaus/plexus/digest/StreamingSha1Digester.java index b212e7c..384b500 100644 --- a/src/main/java/org/codehaus/plexus/digest/StreamingSha1Digester.java +++ b/src/main/java/org/codehaus/plexus/digest/StreamingSha1Digester.java @@ -25,6 +25,9 @@ public class StreamingSha1Digester extends AbstractStreamingDigester { + /** + *

Constructor for StreamingSha1Digester.

+ */ public StreamingSha1Digester() { super( "SHA-1" );