aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-02 11:04:27 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2018-03-03 23:58:49 +0100
commitcf489d36b9d5c9e1c0017d267fb92287f52aa9df (patch)
tree9c6f4935103a8cb10e206b9b0b68658cde109ac5 /org.eclipse.jgit/src/org
parenta73f6c60093e8477fa06313034cb325add79e85c (diff)
downloadjgit-cf489d36b9d5c9e1c0017d267fb92287f52aa9df.tar.gz
jgit-cf489d36b9d5c9e1c0017d267fb92287f52aa9df.zip
TagBuilder: Open OutputStreamWriter in try-with-resource
Change-Id: Ic0e23039b0aec6171f192234c6b1474cd32eadff Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java
index 90ef5c779f..32ef504802 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TagBuilder.java
@@ -180,8 +180,8 @@ public class TagBuilder {
*/
public byte[] build() {
ByteArrayOutputStream os = new ByteArrayOutputStream();
- OutputStreamWriter w = new OutputStreamWriter(os, Constants.CHARSET);
- try {
+ try (OutputStreamWriter w = new OutputStreamWriter(os,
+ Constants.CHARSET)) {
w.write("object "); //$NON-NLS-1$
getObjectId().copyTo(w);
w.write('\n');
@@ -203,7 +203,6 @@ public class TagBuilder {
w.write('\n');
if (getMessage() != null)
w.write(getMessage());
- w.close();
} catch (IOException err) {
// This should never occur, the only way to get it above is
// for the ByteArrayOutputStream to throw, but it doesn't.