IDEMPIERE-613 Column Encryption Enhancement. Fixerd synchronization and release of resource .
This commit is contained in:
parent
3e5608734b
commit
d26c8845b5
|
@ -57,9 +57,11 @@ public class DefaultKeyStore implements IKeyStore {
|
||||||
public DefaultKeyStore(){
|
public DefaultKeyStore(){
|
||||||
File file = new File(Ini.getAdempiereHome(), IDEMPIERE_KEYSTORE_PROPERTIES);
|
File file = new File(Ini.getAdempiereHome(), IDEMPIERE_KEYSTORE_PROPERTIES);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
|
FileInputStream is = null;
|
||||||
try{
|
try{
|
||||||
|
is = new FileInputStream(file);
|
||||||
Properties p = new Properties();
|
Properties p = new Properties();
|
||||||
p.load(new FileInputStream(file));
|
p.load(is);
|
||||||
String s = p.getProperty("password");
|
String s = p.getProperty("password");
|
||||||
String a = p.getProperty("algorithm");
|
String a = p.getProperty("algorithm");
|
||||||
if (!Util.isEmpty(s) && !Util.isEmpty(a)) {
|
if (!Util.isEmpty(s) && !Util.isEmpty(a)) {
|
||||||
|
@ -80,6 +82,11 @@ public class DefaultKeyStore implements IKeyStore {
|
||||||
log.log(Level.SEVERE, "", ex);
|
log.log(Level.SEVERE, "", ex);
|
||||||
password = null;
|
password = null;
|
||||||
createLegacyKey();
|
createLegacyKey();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (is != null)
|
||||||
|
is.close();
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createLegacyKey();
|
createLegacyKey();
|
||||||
|
@ -92,7 +99,7 @@ public class DefaultKeyStore implements IKeyStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SecretKey getKey(int AD_Client_ID) {
|
public synchronized SecretKey getKey(int AD_Client_ID) {
|
||||||
if (password != null) {
|
if (password != null) {
|
||||||
try {
|
try {
|
||||||
PasswordProtection protParam = new PasswordProtection(password);
|
PasswordProtection protParam = new PasswordProtection(password);
|
||||||
|
|
Loading…
Reference in New Issue