From ec72e8029ebbb28b37fef5c3d84a2bb55e788203 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 21 Jan 2019 15:20:25 +0900 Subject: [PATCH] SmartClientSmartServerTest: Open ObjectInserter.Formatter in try-with-resource Change-Id: I7005f5821394a3e237cf877cf38557b6a62cacb3 Signed-off-by: David Pursehouse --- .../jgit/http/test/SmartClientSmartServerTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java index 508977042..420e48971 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java @@ -1169,9 +1169,11 @@ public class SmartClientSmartServerTest extends HttpTestCase { @Test public void testInvalidWant() throws Exception { - @SuppressWarnings("resource") - ObjectId id = new ObjectInserter.Formatter().idFor(Constants.OBJ_BLOB, - "testInvalidWant".getBytes(UTF_8)); + ObjectId id; + try (ObjectInserter.Formatter formatter = new ObjectInserter.Formatter()) { + id = formatter.idFor(Constants.OBJ_BLOB, + "testInvalidWant".getBytes(UTF_8)); + } Repository dst = createBareRepository(); try (Transport t = Transport.open(dst, remoteURI);