Author: vyemialyanchyk
Date: 2009-04-09 09:28:48 -0400 (Thu, 09 Apr 2009)
New Revision: 14633
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
JBIDE-4138
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-04-09
13:22:12 UTC (rev 14632)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-04-09
13:28:48 UTC (rev 14633)
@@ -664,6 +664,7 @@
public void save(){
Properties properties = new Properties();
storeProperties(properties, this);
+ FileOutputStream fos = null;
try {
File folder = new File(getStoreFolderPath().toOSString());
if(!folder.exists()) {
@@ -673,10 +674,18 @@
if(!file.exists()) {
file.createNewFile();
}
- FileOutputStream fos = new FileOutputStream(file);
+ fos = new FileOutputStream(file);
properties.store(fos, ""); //$NON-NLS-1$
} catch (IOException e) {
VisualEditorPlugin.getDefault().logError("Can't save layout of
mapping.", e); //$NON-NLS-1$
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
}
@@ -733,9 +742,9 @@
private void setState(Properties properties,String key, boolean value){
if(properties.containsKey(key)){
properties.remove(key);
- properties.put(key, new Boolean(value).toString());
+ properties.put(key, Boolean.valueOf(value).toString());
}else{
- properties.put(key, new Boolean(value).toString());
+ properties.put(key, Boolean.valueOf(value).toString());
}
}
@@ -746,7 +755,7 @@
private boolean getState(Properties properties, String key){
String str = properties.getProperty(key, "true"); //$NON-NLS-1$
- return new Boolean(str).booleanValue();
+ return Boolean.valueOf(str).booleanValue();
}
private Point getPoint(Properties properties, String key){