Author: vyemialyanchyk
Date: 2009-02-26 07:52:39 -0500 (Thu, 26 Feb 2009)
New Revision: 13830
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
close stream in finally and add npe check
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-02-26
12:38:15 UTC (rev 13829)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-02-26
12:52:39 UTC (rev 13830)
@@ -394,7 +394,7 @@
}
finally {
try {
- stream.close();
+ if (stream!=null) stream.close();
}
catch (IOException ioe) {
//log.warn( "could not close input stream for: " + resourceName, ioe );
@@ -417,21 +417,19 @@
InputStream is = null;
try {
is = ConfigHelper.getResourceAsStream(resource);
- } catch(HibernateException e) {
+ }
+ catch (HibernateException e) {
// just ignore
}
- boolean res = false;
- if (is != null )
- {
- res = true;
+ finally {
try {
- is.close();
+ if (is != null) is.close();
}
catch (IOException e) {
// ignore
}
}
- return res;
+ return (is != null);
}
/**
Show replies by date