Laszlo Hornyak has uploaded a new change for review.

Change subject: engine: handle null values in EngineEncryptionUtils
......................................................................

engine: handle null values in EngineEncryptionUtils

changes both the encrypt and decrypt methods to return null on null
input - as junit tests expect it to be.

Change-Id: Ic2d736ea71c8af1ac9facffd4b2b005edb5da70c
Signed-off-by: Laszlo Hornyak <[email protected]>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/crypt/EngineEncryptionUtils.java
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/16180/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/crypt/EngineEncryptionUtils.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/crypt/EngineEncryptionUtils.java
index 7ef8c73..4482b02 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/crypt/EngineEncryptionUtils.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/crypt/EngineEncryptionUtils.java
@@ -140,7 +140,10 @@
      * Please notice that empty strings are not encrypted and returend as-is.
      */
     public static String encrypt(String source) throws 
GeneralSecurityException {
-        if (source == null || source.trim().length() == 0) {
+        if( source == null) {
+            return null;
+        }
+        if (source.trim().length() == 0) {
             return "";
         }
         else {
@@ -160,7 +163,10 @@
      * Please notice that empty strings are not decrypted and returend as-is.
      */
     public static String decrypt(String source) throws 
GeneralSecurityException {
-        if (source == null || source.trim().length() == 0) {
+        if(source == null) {
+            return null;
+        }
+        if (source.trim().length() == 0) {
             return "";
         }
         else {


-- 
To view, visit http://gerrit.ovirt.org/16180
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2d736ea71c8af1ac9facffd4b2b005edb5da70c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to