|
17 | 17 | package com.cloud.agent; |
18 | 18 |
|
19 | 19 | import java.io.File; |
20 | | -import java.io.FileInputStream; |
21 | 20 | import java.io.FileNotFoundException; |
22 | 21 | import java.io.IOException; |
23 | | -import java.io.InputStream; |
24 | 22 | import java.lang.reflect.Constructor; |
25 | 23 | import java.lang.reflect.InvocationTargetException; |
26 | 24 | import java.util.ArrayList; |
|
37 | 35 | import org.apache.commons.daemon.Daemon; |
38 | 36 | import org.apache.commons.daemon.DaemonContext; |
39 | 37 | import org.apache.commons.daemon.DaemonInitException; |
40 | | -import org.apache.commons.io.IOUtils; |
41 | 38 | import org.apache.commons.lang.math.NumberUtils; |
42 | 39 | import org.apache.log4j.Logger; |
43 | 40 | import org.apache.log4j.xml.DOMConfigurator; |
@@ -174,16 +171,12 @@ void loadProperties() throws ConfigurationException { |
174 | 171 |
|
175 | 172 | s_logger.info("agent.properties found at " + file.getAbsolutePath()); |
176 | 173 |
|
177 | | - InputStream propertiesStream = null; |
178 | 174 | try { |
179 | | - propertiesStream = new FileInputStream(file); |
180 | | - _properties.load(propertiesStream); |
| 175 | + PropertiesUtil.loadFromFile(_properties, file); |
181 | 176 | } catch (final FileNotFoundException ex) { |
182 | 177 | throw new CloudRuntimeException("Cannot find the file: " + file.getAbsolutePath(), ex); |
183 | 178 | } catch (final IOException ex) { |
184 | 179 | throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex); |
185 | | - } finally { |
186 | | - IOUtils.closeQuietly(propertiesStream); |
187 | 180 | } |
188 | 181 | } |
189 | 182 |
|
|
0 commit comments