JavaDoc cleanup, enforce Turbine coding standards

git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/crypto@1852158 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/fulcrum/crypto/CryptoAlgorithm.java b/src/java/org/apache/fulcrum/crypto/CryptoAlgorithm.java
index 0891e28..842512d 100644
--- a/src/java/org/apache/fulcrum/crypto/CryptoAlgorithm.java
+++ b/src/java/org/apache/fulcrum/crypto/CryptoAlgorithm.java
@@ -28,7 +28,6 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-
 public interface CryptoAlgorithm
 {
     /**
diff --git a/src/java/org/apache/fulcrum/crypto/CryptoService.java b/src/java/org/apache/fulcrum/crypto/CryptoService.java
index 3e79c83..78d1bf0 100644
--- a/src/java/org/apache/fulcrum/crypto/CryptoService.java
+++ b/src/java/org/apache/fulcrum/crypto/CryptoService.java
@@ -1,6 +1,5 @@
 package org.apache.fulcrum.crypto;
 
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,7 +19,6 @@
  * under the License.
  */
 
-
 import java.security.NoSuchAlgorithmException;
 
 /**
@@ -30,6 +28,7 @@
  *
  * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
  * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
+ * @version $Id$ 
  */
 public interface CryptoService
 {
@@ -39,10 +38,8 @@
    * Returns a CryptoAlgorithm Object which represents the requested
    * crypto algorithm.
    *
-   * @param algo      Name of the requested algorithm
-   *
+   * @param algo Name of the requested algorithm
    * @return An Object representing the algorithm
-   *
    * @throws NoSuchAlgorithmException  Requested algorithm is not available
    *
    */
diff --git a/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java b/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java
index 96534e8..6509aff 100644
--- a/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java
+++ b/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java
@@ -40,8 +40,7 @@
  *
  * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
- * @version $Id: DefaultCryptoService.java 581797 2007-10-04 08:26:18Z sgoeschl
- *          $
+ * @version $Id$
  */
 public class DefaultCryptoService extends AbstractLogEnabled
 		implements CryptoService, Configurable, Initializable, ThreadSafe {
@@ -63,6 +62,8 @@
 	 * Returns a CryptoAlgorithm Object which represents the requested crypto
 	 * algorithm.
 	 *
+	 * @see org.apache.fulcrum.crypto.CryptoService#getCryptoAlgorithm(java.lang.String)
+	 *
 	 * @param algo Name of the requested algorithm
 	 *
 	 * @return An Object representing the algorithm
@@ -117,9 +118,11 @@
 	}
 	
 	/**
-	 * {@link org.apache.avalon.framework.activity.Initializable#initialize()}
+	 * Initialize the service
 	 * 
-	 * @throws Exception generic exception
+	 * @see org.apache.avalon.framework.activity.Initializable#initialize()
+	 * 
+	 * @throws Exception if initialization fails
 	 */
 	public void initialize() throws Exception 
 	{
diff --git a/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java b/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java
index e237a2c..18ae8a2 100644
--- a/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java
+++ b/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java
@@ -31,7 +31,6 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-
 public class ClearCrypt implements CryptoAlgorithm {
 	
 	/**
@@ -48,7 +47,6 @@
 	 */
 	public void setCipher(String cipher) 
 	{
-		/* dummy */
 	}
 
 	/**
@@ -58,22 +56,18 @@
 	 */
 	public void setSeed(String seed) 
 	{
-		/* dummy */
 	}
 
 	/**
-	 * encrypt the supplied string with the requested cipher
+	 * This method performs no encryption and will simply
+	 * return the value passed
 	 *
 	 * @param value The value to be encrypted
-	 * @return The encrypted value
+	 * @return The original value
 	 * @throws Exception An Exception of the underlying implementation.
 	 */
 	public String encrypt(String value) throws Exception 
 	{
-		/*
-		 * Ultra-clever implementation. ;-)
-		 */
-
 		return value;
 	}
 }
diff --git a/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java b/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java
index e5a85b6..edc5e29 100644
--- a/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java
+++ b/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java
@@ -41,8 +41,8 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-
-public class JavaCrypt implements CryptoAlgorithm {
+public class JavaCrypt implements CryptoAlgorithm 
+{
 
 	/** The default cipher */
 	public static final String DEFAULT_CIPHER = "SHA";
@@ -51,7 +51,7 @@
 	private String cipher = null;
 
 	/**
-	 * Constructo
+	 * Constructor
 	 *
 	 */
 	public JavaCrypt() 
@@ -66,6 +66,8 @@
 	 * This will never throw an error even if there is no provider for this cipher.
 	 * The error will be thrown by encrypt() (Fixme?)
 	 *
+	 * @see org.apache.fulcrum.crypto.CryptoAlgorithm#setCipher(java.lang.String)
+	 *
 	 * @param cipher The cipher to use.
 	 *
 	 */
@@ -77,6 +79,8 @@
 	/**
 	 * This class never uses a seed, so this is just a dummy.
 	 *
+	 * @see org.apache.fulcrum.crypto.CryptoAlgorithm#setSeed(java.lang.String)
+	 * 
 	 * @param seed Seed (ignored)
 	 *
 	 */
@@ -86,7 +90,9 @@
 	}
 
 	/**
-	 * encrypt the supplied string with the requested cipher
+	 * Encrypt the supplied string with the requested cipher
+	 *
+	 * @see org.apache.fulcrum.crypto.CryptoAlgorithm#encrypt(java.lang.String)
 	 *
 	 * @param value The value to be encrypted
 	 * @return The encrypted value
diff --git a/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java b/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java
index 8ca9445..4b985aa 100644
--- a/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java
+++ b/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java
@@ -41,9 +41,8 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-
-public class OldJavaCrypt implements CryptoAlgorithm {
-
+public class OldJavaCrypt implements CryptoAlgorithm 
+{
 	/** The default cipher */
 	public static final String DEFAULT_CIPHER = "SHA";
 
@@ -85,7 +84,7 @@
 	}
 
 	/**
-	 * encrypt the supplied string with the requested cipher
+	 * Encrypt the supplied string with the requested cipher
 	 *
 	 * @param value The value to be encrypted
 	 * @return The encrypted value
@@ -96,10 +95,12 @@
 		MessageDigest md = MessageDigest.getInstance(cipher);
 		byte[] digest = md.digest(value.getBytes("UTF-8"));
 		byte[] base64 = Base64.encodeBase64(digest);
+		
 		// from MD5 the digest has 16 bytes but for SHA1 it contains 20 bytes
-		// depending on the digest lenght the result is truncated
+		// depending on the digest length the result is truncated
 		int len = (digest.length == 16 ? 20 : 24);
 		byte[] result = new byte[len];
+		
 		System.arraycopy(base64, 0, result, 0, result.length);
 		return new String(result, "UTF-8");
 	}
diff --git a/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java b/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java
index 62b56ca..0e067ee 100644
--- a/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java
+++ b/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java
@@ -19,17 +19,18 @@
  * under the License.
  */
 
-import org.apache.fulcrum.crypto.CryptoAlgorithm;
 import java.util.Random;
 
+import org.apache.fulcrum.crypto.CryptoAlgorithm;
+
 /**
  * Implements Standard Unix crypt(3) for use with the Crypto Service.
  *
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-
-public class UnixCrypt implements CryptoAlgorithm {
+public class UnixCrypt implements CryptoAlgorithm 
+{
 
 	/** The seed to use */
 	private String seed = null;
@@ -68,7 +69,7 @@
 	}
 
 	/**
-	 * encrypt the supplied string with the requested cipher
+	 * Encrypt the supplied string with the requested cipher
 	 *
 	 * @param value The value to be encrypted
 	 * @return The encrypted value
@@ -76,7 +77,8 @@
 	 */
 	public String encrypt(String value) throws Exception 
 	{
-		if (seed == null) {
+		if (seed == null) 
+		{
 			Random randomGenerator = new Random();
 			int numSaltChars = SALT_CHARS.length;
 			StringBuilder sb = new StringBuilder();
diff --git a/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java b/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java
index 708aa7d..e5fd1b9 100644
--- a/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java
+++ b/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java
@@ -69,12 +69,14 @@
         String preDefinedResult = "z5EQaXpuu059c";
 
         CryptoAlgorithm ca = sc.getCryptoAlgorithm("unix");
+        
         /*
          * Test predefined Seed
          */
         ca.setSeed(preDefinedSeed);
         String output = ca.encrypt(preDefinedInput);
         assertEquals( preDefinedResult, output, "Encryption failed ");
+        
         /*
          * Test random Seed
          *
@@ -87,6 +89,10 @@
 
     }
     
+    /**
+     * Test no encryption 
+     * @throws Exception exception
+     */
     @Test
     public void testClearCrypt() throws Exception
     {
@@ -98,6 +104,9 @@
 
     }
     
+    /**
+     * @throws Exception exception
+     */
     @Test
     @DisplayName("OldJavaCrypt: Truncated base64 from MD5 (Turbine 2.1) Test")
     public void testOldJavaCryptMd5() throws Exception
@@ -111,6 +120,9 @@
 
     }
     
+    /**
+     * @throws Exception exception
+     */
     @Test
     public void testOldJavaCryptSha1() throws Exception
     {
@@ -123,6 +135,9 @@
 
     }
     
+    /**
+     * @throws Exception exception
+     */
     @Test
     public void testJavaCryptMd5() throws Exception
     {
@@ -133,6 +148,9 @@
         assertEquals( preDefinedResult, output, "MD5 Encryption failed ");
     }
     
+    /**
+     * @throws Exception exception
+     */
     @Test
     public void testJavaCryptSha1() throws Exception
     {
@@ -144,6 +162,9 @@
 
     }
     
+    /**
+     * @throws Exception exception
+     */
     @Test
     public void testJavaCryptSha256() throws Exception
     {
@@ -154,6 +175,9 @@
         assertEquals( preDefinedResult, output, "SHA256 Encryption failed ");
     }
     
+    /**
+     * @throws Exception exception
+     */
     @Test
     public void testJavaCryptSha512() throws Exception
     {