Author: akazakov
Date: 2011-11-11 19:46:30 -0500 (Fri, 11 Nov 2011)
New Revision: 36313
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-10137 Close input and output stream in all places
where it used
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2011-11-12
00:45:29 UTC (rev 36312)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2011-11-12
00:46:30 UTC (rev 36313)
@@ -13,7 +13,6 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
@@ -23,7 +22,6 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
@@ -184,9 +182,14 @@
if(l < 0) break;
sb.append(new String(b, 0, l));
}
- is.close();
} catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // Ignore
+ }
}
return sb.toString();
}
@@ -222,10 +225,16 @@
if(l < 0) break;
sb.append(new String(b, 0, l, charset));
}
- is.close();
} catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // Ignore
+ }
}
+
return sb.toString();
}