IDEMPIERE-5604 Column Encryption not marking column as encrypted - data corruption (#1766)

This commit is contained in:
Carlos Ruiz 2023-04-02 09:38:37 +02:00 committed by GitHub
parent 65f565e542
commit 022ff3749b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 38 deletions

View File

@ -193,6 +193,11 @@ public class ColumnEncryption extends SvrProcess {
}
}
if (error) {
msglog = new StringBuilder("Encryption NOT changed - Encryption=")
.append(column.isEncrypted());
addLog(0, null, null, msglog.toString());
} else {
count = 0;
// If only user chooses both encrypt the contents and override current
// settings resize the physical column and encrypt all its contents.
@ -226,12 +231,6 @@ public class ColumnEncryption extends SvrProcess {
throw new Exception();
}
}
if (error || !p_ChangeSetting){
msglog = new StringBuilder("Encryption NOT changed - Encryption=")
.append(column.isEncrypted());
addLog(0, null, null, msglog.toString());
} else {
column.setIsEncrypted(p_IsEncrypted);
if (column.save()){
addLog(0, null, null, "#" + (p_IsEncrypted ? "Encrypted=" : "Decrypted=") +count);
@ -240,10 +239,10 @@ public class ColumnEncryption extends SvrProcess {
addLog(0, null, null, msglog.toString());
} else
addLog(0, null, null, "Save Error");
}
} else {
addLog(0, null, null, "Can't perform " + (p_IsEncrypted ? "encryption. " : "decryption. ") + "Column is " + (p_IsEncrypted ? "already Encrypted." : " not Encrypted."));
}
}
StringBuilder msgreturn = new StringBuilder("Encryption=").append(column.isEncrypted());
return msgreturn.toString();