aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-07 18:45:13 (EDT)
committerKevin Sawicki2011-04-07 18:45:13 (EDT)
commit37149b81b93e8cbf89ccac42150acc1d0ba891cf (patch)
treeed5a08531b14c5fc3ec020736a664e4c0d54a3d1
parent0cc416511934c71fb9c3e0ab7c6312d733ffc16c (diff)
downloadegit-github-37149b81b93e8cbf89ccac42150acc1d0ba891cf.zip
egit-github-37149b81b93e8cbf89ccac42150acc1d0ba891cf.tar.gz
egit-github-37149b81b93e8cbf89ccac42150acc1d0ba891cf.tar.bz2
Close reader and use StringBuilder instead of StringBuffer.refs/changes/23/3023/1
Change-Id: I33506b4399918c4b4194b73ed6cb1f34a26b286f Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java
index 0573d99..6392809 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java
@@ -73,10 +73,11 @@ public class CreateGistHandler extends AbstractHandler {
}
private void createGistJob(IFile file) {
+ BufferedReader br = null;
try {
- BufferedReader br = new BufferedReader(new InputStreamReader(file.getContents()));
+ br = new BufferedReader(new InputStreamReader(file.getContents()));
String line;
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
while ((line = br.readLine()) != null) {
result.append(line);
result.append('\n');
@@ -87,6 +88,13 @@ public class CreateGistHandler extends AbstractHandler {
GitHubUi.logError(e);
} catch (IOException e) {
GitHubUi.logError(e);
+ } finally {
+ if (br != null)
+ try {
+ br.close();
+ } catch (IOException e) {
+ GitHubUi.logError(e);
+ }
}
}