mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixed coverity issues reported
This commit is contained in:
parent
1cf1abcf47
commit
b371356abc
@ -441,13 +441,15 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
||||
if (propsFile == null) {
|
||||
return null;
|
||||
} else {
|
||||
final FileInputStream finputstream = new FileInputStream(propsFile);
|
||||
final Properties props = new Properties();
|
||||
try(final FileInputStream finputstream = new FileInputStream(propsFile);) {
|
||||
props.load(finputstream);
|
||||
finputstream.close();
|
||||
}catch (IOException e) {
|
||||
s_logger.error("getEnvironmentProperty:Exception:" + e.getMessage());
|
||||
}
|
||||
return props.getProperty("mount.parent");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -846,10 +848,10 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
||||
}
|
||||
|
||||
if (keyfile.exists()) {
|
||||
try {
|
||||
FileOutputStream kStream = new FileOutputStream(keyfile);
|
||||
try (FileOutputStream kStream = new FileOutputStream(keyfile);){
|
||||
if (kStream != null) {
|
||||
kStream.write(key.getBytes());
|
||||
kStream.close();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
s_logger.warn("Failed to write key to " + keyfile.getAbsolutePath());
|
||||
throw new CloudRuntimeException("Failed to update keypairs on disk: cannot find key file " + keyPath);
|
||||
|
||||
@ -1361,8 +1361,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
if (tmpFile == null) {
|
||||
continue;
|
||||
}
|
||||
FileReader fr = new FileReader(tmpFile);
|
||||
BufferedReader brf = new BufferedReader(fr);
|
||||
try (FileReader fr = new FileReader(tmpFile);
|
||||
BufferedReader brf = new BufferedReader(fr);) {
|
||||
String line = null;
|
||||
String uniqName = null;
|
||||
Long size = null;
|
||||
@ -1376,13 +1376,16 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
name = line.split("=")[1];
|
||||
}
|
||||
}
|
||||
brf.close();
|
||||
tempFile.delete();
|
||||
if (uniqName != null) {
|
||||
TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, size, true, false);
|
||||
tmpltInfos.put(uniqName, prop);
|
||||
}
|
||||
|
||||
} catch (IOException ex)
|
||||
{
|
||||
s_logger.debug("swiftListTemplate:Exception:" + ex.getMessage());
|
||||
continue;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.debug("Failed to create templ file:" + e.toString());
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user