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) { |             if (propsFile == null) { | ||||||
|                 return null; |                 return null; | ||||||
|             } else { |             } else { | ||||||
|                 final FileInputStream finputstream = new FileInputStream(propsFile); |  | ||||||
|                 final Properties props = new Properties(); |                 final Properties props = new Properties(); | ||||||
|  |                 try(final FileInputStream finputstream = new FileInputStream(propsFile);) { | ||||||
|                     props.load(finputstream); |                     props.load(finputstream); | ||||||
|                 finputstream.close(); |                 }catch (IOException e) { | ||||||
|  |                     s_logger.error("getEnvironmentProperty:Exception:" + e.getMessage()); | ||||||
|  |                 } | ||||||
|                 return props.getProperty("mount.parent"); |                 return props.getProperty("mount.parent"); | ||||||
|             } |             } | ||||||
|         } catch (IOException e) { |         } catch (Exception e) { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @ -846,10 +848,10 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (keyfile.exists()) { |         if (keyfile.exists()) { | ||||||
|             try { |             try (FileOutputStream kStream = new FileOutputStream(keyfile);){ | ||||||
|                 FileOutputStream kStream = new FileOutputStream(keyfile); |                 if (kStream != null) { | ||||||
|                     kStream.write(key.getBytes()); |                     kStream.write(key.getBytes()); | ||||||
|                 kStream.close(); |                 } | ||||||
|             } catch (FileNotFoundException e) { |             } catch (FileNotFoundException e) { | ||||||
|                 s_logger.warn("Failed to write  key to " + keyfile.getAbsolutePath()); |                 s_logger.warn("Failed to write  key to " + keyfile.getAbsolutePath()); | ||||||
|                 throw new CloudRuntimeException("Failed to update keypairs on disk: cannot find  key file " + keyPath); |                 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) { |                     if (tmpFile == null) { | ||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
|                     FileReader fr = new FileReader(tmpFile); |                     try (FileReader fr = new FileReader(tmpFile); | ||||||
|                     BufferedReader brf = new BufferedReader(fr); |                          BufferedReader brf = new BufferedReader(fr);) { | ||||||
|                         String line = null; |                         String line = null; | ||||||
|                         String uniqName = null; |                         String uniqName = null; | ||||||
|                         Long size = null; |                         Long size = null; | ||||||
| @ -1376,13 +1376,16 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S | |||||||
|                                 name = line.split("=")[1]; |                                 name = line.split("=")[1]; | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     brf.close(); |  | ||||||
|                         tempFile.delete(); |                         tempFile.delete(); | ||||||
|                         if (uniqName != null) { |                         if (uniqName != null) { | ||||||
|                             TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, size, true, false); |                             TemplateProp prop = new TemplateProp(uniqName, container + File.separator + name, size, size, true, false); | ||||||
|                             tmpltInfos.put(uniqName, prop); |                             tmpltInfos.put(uniqName, prop); | ||||||
|                         } |                         } | ||||||
| 
 |                     } catch (IOException ex) | ||||||
|  |                     { | ||||||
|  |                         s_logger.debug("swiftListTemplate:Exception:" + ex.getMessage()); | ||||||
|  |                         continue; | ||||||
|  |                     } | ||||||
|                 } catch (IOException e) { |                 } catch (IOException e) { | ||||||
|                     s_logger.debug("Failed to create templ file:" + e.toString()); |                     s_logger.debug("Failed to create templ file:" + e.toString()); | ||||||
|                     continue; |                     continue; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user