svn commit: r1813854 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto: BlowFishCrypt.java HashCrypt.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1813854 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto: BlowFishCrypt.java HashCrypt.java

jleroux@apache.org
Author: jleroux
Date: Tue Oct 31 08:15:00 2017
New Revision: 1813854

URL: http://svn.apache.org/viewvc?rev=1813854&view=rev
Log:
No functional change, formatting while reviewing r1812049

Actually I'm unsure of how to present multiple expressions for autocloseables
in try blocks (here automatically done by my Eclipse formatter). This should be
discussed with the community so we agreed on formatting rules to create an
official Eclipse formatter as being discussed at https://s.apache.org/0ptF

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java?rev=1813854&r1=1813853&r2=1813854&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java Tue Oct 31 08:15:00 2017
@@ -162,8 +162,8 @@ public class BlowFishCrypt {
 
         byte[] key = generateKey();
         if (testKey(key)) {
-            try ( FileOutputStream fos = new FileOutputStream(args[0]);
-                  ObjectOutputStream os = new ObjectOutputStream(fos)) {
+            try (FileOutputStream fos = new FileOutputStream(args[0]);
+                    ObjectOutputStream os = new ObjectOutputStream(fos)) {
                 String keyString = new String(key, StandardCharsets.UTF_8);
                 os.writeObject(keyString);
             }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java?rev=1813854&r1=1813853&r2=1813854&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java Tue Oct 31 08:15:00 2017
@@ -19,7 +19,6 @@
 package org.apache.ofbiz.base.crypto;
 
 import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
@@ -174,20 +173,20 @@ public class HashCrypt {
             byte[] hash = Base64.encodeBase64(skf.generateSecret(spec).getEncoded());
             String pbkdf2Type = null;
             switch (hashType) {
-            case "PBKDF2WithHmacSHA1":
-                pbkdf2Type = PBKDF2_SHA1;
-                break;
-            case "PBKDF2WithHmacSHA256":
-                pbkdf2Type = PBKDF2_SHA256;
-                break;
-            case "PBKDF2WithHmacSHA384":
-                pbkdf2Type = PBKDF2_SHA384;
-                break;
-            case "PBKDF2WithHmacSHA512":
-                pbkdf2Type = PBKDF2_SHA512;
-                break;
-            default:
-                pbkdf2Type = PBKDF2_SHA1;
+                case "PBKDF2WithHmacSHA1":
+                    pbkdf2Type = PBKDF2_SHA1;
+                    break;
+                case "PBKDF2WithHmacSHA256":
+                    pbkdf2Type = PBKDF2_SHA256;
+                    break;
+                case "PBKDF2WithHmacSHA384":
+                    pbkdf2Type = PBKDF2_SHA384;
+                    break;
+                case "PBKDF2WithHmacSHA512":
+                    pbkdf2Type = PBKDF2_SHA512;
+                    break;
+                default:
+                    pbkdf2Type = PBKDF2_SHA1;
             }
             StringBuilder sb = new StringBuilder();
             sb.append("{").append(pbkdf2Type).append("}");