You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2019/01/07 16:47:10 UTC

svn commit: r1850667 - in /turbine/fulcrum/trunk/crypto/src: java/org/apache/fulcrum/crypto/ java/org/apache/fulcrum/crypto/provider/ test/org/apache/fulcrum/crypto/

Author: painter
Date: Mon Jan  7 16:47:10 2019
New Revision: 1850667

URL: http://svn.apache.org/viewvc?rev=1850667&view=rev
Log:
Turbine coding standards/format updates

Modified:
    turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java
    turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java
    turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java
    turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java
    turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java
    turbine/fulcrum/trunk/crypto/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java

Modified: turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java?rev=1850667&r1=1850666&r2=1850667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java (original)
+++ turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/DefaultCryptoService.java Mon Jan  7 16:47:10 2019
@@ -70,7 +70,8 @@ public class DefaultCryptoService extend
 	 * @throws NoSuchAlgorithmException Requested algorithm is not available
 	 *
 	 */
-	public CryptoAlgorithm getCryptoAlgorithm(String algo) throws NoSuchAlgorithmException {
+	public CryptoAlgorithm getCryptoAlgorithm(String algo) throws NoSuchAlgorithmException 
+	{
 		String cryptoClass = (String) algos.get(algo);
 		CryptoAlgorithm ca = null;
 		if (cryptoClass == null) {
@@ -98,8 +99,8 @@ public class DefaultCryptoService extend
 	 * @param conf the configuration
 	 * @throws ConfigurationException if not found
 	 */
-	public void configure(Configuration conf) throws ConfigurationException {
-		
+	public void configure(Configuration conf) throws ConfigurationException 
+	{
 		// Initialize the hash and setup default
 		// Can be overriden by default key from properties
 		this.algos = new HashMap<>();
@@ -120,14 +121,16 @@ public class DefaultCryptoService extend
 	 * 
 	 * @throws Exception generic exception
 	 */
-	public void initialize() throws Exception {
+	public void initialize() throws Exception 
+	{
 		getLogger().debug("initialize()");
 	}
 
 	/**
 	 * Avalon component lifecycle method
 	 */
-	public void dispose() {
+	public void dispose() 
+	{
 		algos = null;
 	}
 

Modified: turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java?rev=1850667&r1=1850666&r2=1850667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java (original)
+++ turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java Mon Jan  7 16:47:10 2019
@@ -37,7 +37,8 @@ public class ClearCrypt implements Crypt
 	/**
 	 * Constructor
 	 */
-	public ClearCrypt() {
+	public ClearCrypt() 
+	{
 	}
 
 	/**
@@ -45,7 +46,8 @@ public class ClearCrypt implements Crypt
 	 *
 	 * @param cipher Cipher (ignored)
 	 */
-	public void setCipher(String cipher) {
+	public void setCipher(String cipher) 
+	{
 		/* dummy */
 	}
 
@@ -54,7 +56,8 @@ public class ClearCrypt implements Crypt
 	 *
 	 * @param seed Seed (ignored)
 	 */
-	public void setSeed(String seed) {
+	public void setSeed(String seed) 
+	{
 		/* dummy */
 	}
 
@@ -65,7 +68,8 @@ public class ClearCrypt implements Crypt
 	 * @return The encrypted value
 	 * @throws Exception An Exception of the underlying implementation.
 	 */
-	public String encrypt(String value) throws Exception {
+	public String encrypt(String value) throws Exception 
+	{
 		/*
 		 * Ultra-clever implementation. ;-)
 		 */

Modified: turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java?rev=1850667&r1=1850666&r2=1850667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java (original)
+++ turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java Mon Jan  7 16:47:10 2019
@@ -54,7 +54,8 @@ public class JavaCrypt implements Crypto
 	 * Constructo
 	 *
 	 */
-	public JavaCrypt() {
+	public JavaCrypt() 
+	{
 		this.cipher = DEFAULT_CIPHER;
 	}
 
@@ -68,7 +69,8 @@ public class JavaCrypt implements Crypto
 	 * @param cipher The cipher to use.
 	 *
 	 */
-	public void setCipher(String cipher) {
+	public void setCipher(String cipher) 
+	{
 		this.cipher = cipher;
 	}
 
@@ -78,7 +80,8 @@ public class JavaCrypt implements Crypto
 	 * @param seed Seed (ignored)
 	 *
 	 */
-	public void setSeed(String seed) {
+	public void setSeed(String seed) 
+	{
 		/* dummy */
 	}
 
@@ -89,7 +92,8 @@ public class JavaCrypt implements Crypto
 	 * @return The encrypted value
 	 * @throws Exception An Exception of the underlying implementation.
 	 */
-	public String encrypt(String value) throws Exception {
+	public String encrypt(String value) throws Exception 
+	{
 		MessageDigest md = MessageDigest.getInstance(cipher);
 
 		// We need to use unicode here, to be independent of platform's

Modified: turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java?rev=1850667&r1=1850666&r2=1850667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java (original)
+++ turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java Mon Jan  7 16:47:10 2019
@@ -53,7 +53,8 @@ public class OldJavaCrypt implements Cry
 	/**
 	 * Constructor
 	 */
-	public OldJavaCrypt() {
+	public OldJavaCrypt() 
+	{
 		this.cipher = DEFAULT_CIPHER;
 	}
 
@@ -67,7 +68,8 @@ public class OldJavaCrypt implements Cry
 	 * @param cipher The cipher to use.
 	 *
 	 */
-	public void setCipher(String cipher) {
+	public void setCipher(String cipher) 
+	{
 		this.cipher = cipher;
 	}
 
@@ -77,7 +79,8 @@ public class OldJavaCrypt implements Cry
 	 * @param seed Seed (ignored)
 	 *
 	 */
-	public void setSeed(String seed) {
+	public void setSeed(String seed) 
+	{
 		/* dummy */
 	}
 
@@ -88,7 +91,8 @@ public class OldJavaCrypt implements Cry
 	 * @return The encrypted value
 	 * @throws Exception An Exception of the underlying implementation.
 	 */
-	public String encrypt(String value) throws Exception {
+	public String encrypt(String value) throws Exception 
+	{
 		MessageDigest md = MessageDigest.getInstance(cipher);
 		byte[] digest = md.digest(value.getBytes("UTF-8"));
 		byte[] base64 = Base64.encodeBase64(digest);

Modified: turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java?rev=1850667&r1=1850666&r2=1850667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java (original)
+++ turbine/fulcrum/trunk/crypto/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java Mon Jan  7 16:47:10 2019
@@ -41,7 +41,8 @@ public class UnixCrypt implements Crypto
 	/**
 	 * Constructor
 	 */
-	public UnixCrypt() {
+	public UnixCrypt() 
+	{
 	}
 
 	/**
@@ -50,7 +51,8 @@ public class UnixCrypt implements Crypto
 	 *
 	 * @param cipher Cipher (ignored)
 	 */
-	public void setCipher(String cipher) {
+	public void setCipher(String cipher) 
+	{
 		/* dummy */
 	}
 
@@ -60,7 +62,8 @@ public class UnixCrypt implements Crypto
 	 *
 	 * @param seed The seed value to use.
 	 */
-	public void setSeed(String seed) {
+	public void setSeed(String seed) 
+	{
 		this.seed = seed;
 	}
 
@@ -71,8 +74,8 @@ public class UnixCrypt implements Crypto
 	 * @return The encrypted value
 	 * @throws Exception An Exception of the underlying implementation.
 	 */
-	public String encrypt(String value) throws Exception {
-
+	public String encrypt(String value) throws Exception 
+	{
 		if (seed == null) {
 			Random randomGenerator = new Random();
 			int numSaltChars = SALT_CHARS.length;

Modified: turbine/fulcrum/trunk/crypto/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/crypto/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java?rev=1850667&r1=1850666&r2=1850667&view=diff
==============================================================================
--- turbine/fulcrum/trunk/crypto/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java (original)
+++ turbine/fulcrum/trunk/crypto/src/test/org/apache/fulcrum/crypto/CryptoServiceTest.java Mon Jan  7 16:47:10 2019
@@ -86,6 +86,7 @@ public class CryptoServiceTest extends B
         assertEquals( output, result, "Encryption failed ");
 
     }
+    
     @Test
     public void testClearCrypt() throws Exception
     {
@@ -96,6 +97,7 @@ public class CryptoServiceTest extends B
         assertEquals( preDefinedResult, output, "Encryption failed ");
 
     }
+    
     @Test
     @DisplayName("OldJavaCrypt: Truncated base64 from MD5 (Turbine 2.1) Test")
     public void testOldJavaCryptMd5() throws Exception
@@ -108,6 +110,7 @@ public class CryptoServiceTest extends B
         assertEquals( preDefinedResult, output, "MD5 Encryption failed ");
 
     }
+    
     @Test
     public void testOldJavaCryptSha1() throws Exception
     {
@@ -119,6 +122,7 @@ public class CryptoServiceTest extends B
         assertEquals( preDefinedResult, output, "SHA1 Encryption failed ");
 
     }
+    
     @Test
     public void testJavaCryptMd5() throws Exception
     {
@@ -128,6 +132,7 @@ public class CryptoServiceTest extends B
         String output = ca.encrypt(preDefinedInput);
         assertEquals( preDefinedResult, output, "MD5 Encryption failed ");
     }
+    
     @Test
     public void testJavaCryptSha1() throws Exception
     {
@@ -138,6 +143,7 @@ public class CryptoServiceTest extends B
         assertEquals( preDefinedResult, output, "SHA1 Encryption failed ");
 
     }
+    
     @Test
     public void testJavaCryptSha256() throws Exception
     {