mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
InputStream use fix
Closes the FileInputStream opened at configuration in - ClusterManagerImpl - ClusterServiceServletAdapter - TransactionLegacy - AsyncJobManagerImpl - DBEncryptionUtil - EncryptionSecretKeyChecker Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
This commit is contained in:
parent
c17831532e
commit
dbaa818d1e
@ -17,7 +17,6 @@
|
|||||||
package com.cloud.cluster;
|
package com.cloud.cluster;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
@ -1033,7 +1032,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
|||||||
File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
||||||
Properties dbProps = new Properties();
|
Properties dbProps = new Properties();
|
||||||
try {
|
try {
|
||||||
dbProps.load(new FileInputStream(dbPropsFile));
|
PropertiesUtil.loadFromFile(dbProps, dbPropsFile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new ConfigurationException("Unable to find db.properties");
|
throw new ConfigurationException("Unable to find db.properties");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
package com.cloud.cluster;
|
package com.cloud.cluster;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
@ -126,7 +125,7 @@ public class ClusterServiceServletAdapter extends AdapterBase implements Cluster
|
|||||||
File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
||||||
Properties dbProps = new Properties();
|
Properties dbProps = new Properties();
|
||||||
try {
|
try {
|
||||||
dbProps.load(new FileInputStream(dbPropsFile));
|
PropertiesUtil.loadFromFile(dbProps, dbPropsFile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new ConfigurationException("Unable to find db.properties");
|
throw new ConfigurationException("Unable to find db.properties");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -1039,6 +1039,7 @@ public class TransactionLegacy {
|
|||||||
dbProps = new Properties();
|
dbProps = new Properties();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
PropertiesUtil.loadFromFile(dbProps, dbPropsFile);
|
||||||
dbProps.load(new FileInputStream(dbPropsFile));
|
dbProps.load(new FileInputStream(dbPropsFile));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
s_logger.fatal("Unable to load db properties file, pl. check the classpath and file path configuration", e);
|
s_logger.fatal("Unable to load db properties file, pl. check the classpath and file path configuration", e);
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
package org.apache.cloudstack.framework.jobs.impl;
|
package org.apache.cloudstack.framework.jobs.impl;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -868,7 +867,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
|||||||
try {
|
try {
|
||||||
final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
||||||
final Properties dbProps = new Properties();
|
final Properties dbProps = new Properties();
|
||||||
dbProps.load(new FileInputStream(dbPropsFile));
|
PropertiesUtil.loadFromFile(dbProps, dbPropsFile);
|
||||||
|
|
||||||
final int cloudMaxActive = Integer.parseInt(dbProps.getProperty("db.cloud.maxActive"));
|
final int cloudMaxActive = Integer.parseInt(dbProps.getProperty("db.cloud.maxActive"));
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public class DBEncryptionUtil {
|
|||||||
StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
|
StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
|
||||||
dbProps = new EncryptableProperties(encryptor);
|
dbProps = new EncryptableProperties(encryptor);
|
||||||
try {
|
try {
|
||||||
dbProps.load(new FileInputStream(dbPropsFile));
|
PropertiesUtil.loadFromFile(dbProps, dbPropsFile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new CloudRuntimeException("db.properties file not found while reading DB secret key", e);
|
throw new CloudRuntimeException("db.properties file not found while reading DB secret key", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -18,7 +18,6 @@ package com.cloud.utils.crypt;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -62,7 +61,7 @@ public class EncryptionSecretKeyChecker extends AdapterBase implements SystemInt
|
|||||||
final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
|
||||||
final Properties dbProps = new Properties();
|
final Properties dbProps = new Properties();
|
||||||
try {
|
try {
|
||||||
dbProps.load(new FileInputStream(dbPropsFile));
|
PropertiesUtil.loadFromFile(dbProps, dbPropsFile);
|
||||||
|
|
||||||
final String encryptionType = dbProps.getProperty("db.cloud.encryption.type");
|
final String encryptionType = dbProps.getProperty("db.cloud.encryption.type");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user