import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
outputFile = property.getPropertyFile();
}
+ FileOutputStream fos = null;
try {
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
property.getPropertyFile().getParentFile().mkdirs();
}
- marshaller.marshal(property.getConfiguration(), new FileOutputStream(outputFile));
+ fos = new FileOutputStream(outputFile);
+ marshaller.marshal(property.getConfiguration(), fos);
} catch (JAXBException e) {
e.printStackTrace();
-
return false;
+
} catch (FileNotFoundException e) {
e.printStackTrace();
-
return false;
+
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e) {
+ EMLogger.getLogger().warning("ERROR : " + e.getMessage());
+ return false;
+ }
+ }
}
return true;