import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.SWTGraphics;
* Export image file to above location
*/
boolean result = true;
+ ImageLoader loader;
+ FileOutputStream os = null;
try {
- FileOutputStream os = new FileOutputStream(exportPath);
- ImageLoader loader = new ImageLoader();
+ os = new FileOutputStream(exportPath);
+ loader = new ImageLoader();
loader.data = new ImageData[] { image.getImageData() };
loader.save(os, SWT.IMAGE_PNG);
latestExportDir = currentExportDir;
Logger.error(e);
result = false;
} finally {
+ try {
+ if (os != null) {
+ os.close();
+ }
+ } catch (IOException e) {
+ result = false;
+ Logger.exception(e);
+ }
image.dispose();
}
if (result == true) {