Commit Graph

6811 Commits

Author SHA1 Message Date
David Pursehouse 4cba10bee4 SmartClientSmartServerTest#addBrokenContext: Remove unused TestRepository
Change-Id: Id2b44199cda7eee7ec949d31b9029ef9325a54f4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 15:17:09 +09:00
David Pursehouse a0f69ff387 IO: Open TemporaryBuffer.Heap in try-with-resource
Change-Id: I78a947fd1263b47b3df17bcc6e9b32497e68dd4a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 14:19:29 +09:00
David Pursehouse f5614e03f1 GitSmartHttpTools: Open SideBandOutputStream in try-with-resource
Change-Id: Ie7c17f98579e7241f2b5c8204435c76686eeb568
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 14:02:02 +09:00
David Pursehouse 95d74f22fb TemporaryBufferTest: Open TemporaryBuffer in try-with-resource
Except the cases where the warning was suppressed in bf757cd because
they are explicitly testing functionality that is not possible in t-w-r.

Change-Id: I6c66eb31a2314028e09a9213dc695cd163f907e9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 13:59:21 +09:00
David Pursehouse d11a40a14c Scanner: Open RevWalk in try-with-resource
Change-Id: Ieeec292c1346edbda2b26f021e75cbc1435bb9f9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 13:45:58 +09:00
David Pursehouse 6503a67e46 SubmoduleWalkTest: Open Repository in try-with-resource
Change-Id: I9c4ee4e4c55f48db1f21e18b212657e4dd3de053
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 13:40:48 +09:00
David Pursehouse df774825f5 SideBandOutputStreamTest: Open SideBandOutputStream in try-with-resource
Change-Id: I34041a556a5a83afcd0c1bab00e5d8088c30ea3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 13:36:31 +09:00
David Pursehouse ecd16a7906 UnionInputStreamTest: Open UnionInputStream in try-with-resource
The tests were written for Java 7 which did not have AutoCloseable
and the try-with-resource concept. When the project was updated to
build with Java 8, the warnings were suppressed.

Remove the suppressions and convert to use try-with-resource.

Change-Id: Ic805bd571c4a2e4376ce5e7c34ca7ac86cbf5104
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 13:28:22 +09:00
David Pursehouse c648a38a47 Merge: Avoid non-localised literal string warning for "recursive"
Instead of using the literal string, take the name from the RECURSIVE
enum value.

Change-Id: I9d8f289232dfc8f784287029c41714ddbdee232b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-21 11:03:46 +09:00
Matthias Sohn 9fee751263 pgm: Fix missing braces in Push.run()
Change-Id: I7cc1b3ca022ba131c196d72c1b776de942442b7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:16 +01:00
Matthias Sohn fa3db15049 pgm: Handle exceptions in Push command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I7a5dc6b1ebaad6f7b8baa35ce68760b79bab8acd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:16 +01:00
Matthias Sohn c821054316 pgm: Fix missing braces in MergeBase.run()
Change-Id: I625053ceb5a81bc0014f7cab0f9fb5e5deaacc36
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:15 +01:00
Matthias Sohn 6c847b30c0 pgm: Handle IOException in MergeBase command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I5f198f71adfbb43ec1af26285658a5d5bdfa1904
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:15 +01:00
Matthias Sohn d614ba3334 pgm: Fix missing braces in Merge command
Change-Id: I39495d832ff4e48a97182faef88871902d3edb11
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:15 +01:00
Matthias Sohn 67910b0570 pgm: Handle exceptions in Merge command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I7afd038d8def9d2f409c0ed297b9db8ea2fc75c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:15 +01:00
Matthias Sohn 0eb0d6c58f pgm: Fix missing braces in LsTree.run()
Change-Id: Iac1755c2ec8094cd211bbc9f1d819cc8052e20cb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:15 +01:00
Matthias Sohn a19ad89d99 pgm: Handle exceptions in LsTree command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ib3ae59eeb90143eca1a0b515c59457a0eb2cc383
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:14 +01:00
Matthias Sohn 1b16fed56a pgm: Fix missing braces in LsRemote.run()
Change-Id: I779a6c28f7e8c4ba0527eb872454fd2cc3d81304
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:14 +01:00
Matthias Sohn 40562d7f5c pgm: Handle exceptions in LsRemote command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: If7dd168f3e8d2b729f1eab48d4e95fe837bb7a33
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:14 +01:00
Matthias Sohn 1978f180a2 pgm: Handle exceptions in LsFiles command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I7d71e194f0a7e4180094a9b36dbb55dd90c9722e
2019-01-21 00:54:14 +01:00
Matthias Sohn 5739d1b314 pgm: Fix missing braces in Log.run()
Change-Id: I3e4f41150aeeffc8c609ef14ce5b6d428c4595d7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:13 +01:00
Matthias Sohn 64386cbfb7 pgm: Handle exceptions in Log command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ibca80cf2195db01298f2b95f507cfa3de2f403e7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:13 +01:00
Matthias Sohn 2d7806da31 pgm: Handle exceptions in Init command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ib8b26a6a02903de63ef58687a4a0820649d59f99
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:13 +01:00
Matthias Sohn 8b15ff57c8 pgm: Handle IOException in IndexPack command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ie8a8388daecb0500f04197462210606c42f143c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-21 00:54:10 +01:00
Matthias Sohn 152e4b43a3 pgm: Fix missing braces in Fetch.run()
Change-Id: I4655417fd879733a357bf712a486ce0883021198
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:41 +01:00
Matthias Sohn 7a64771b9e pgm: Handle IOException in Fetch command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: If8be68621c7135435cd067ef638460b175786b1b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:41 +01:00
Matthias Sohn e65497ad09 pgm: Handle GitAPIException in Gc command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I4d3c04b27727762870d3135228768aae177ea3fc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:41 +01:00
Matthias Sohn 8264135d7c pgm: Fix missing braces in DiffTree.run()
Change-Id: Ic75c7e77516ff1c26803e010bf2bdbaf3e9d6ce1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:40 +01:00
Matthias Sohn c2fb5873b4 pgm: Handle exceptions in DiffTree command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I087b3e510682c68cae74c069b10050c7acb48a29
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:40 +01:00
Matthias Sohn e2d1736e69 pgm: Fix missing braces in Diff.run()
Change-Id: I326b85f49d9b2f3c753f8a38e3f65ee61ba35db3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:40 +01:00
Matthias Sohn a6212392d5 pgm: Handle exceptions in Diff command
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Iba0e4338381519dc55c2892d95181ddfb881adf2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-01-20 22:18:40 +01:00
David Pursehouse b7810bf5a8 RawParseUtils: Avoid import of java.nio.charset.StandardCharsets
The import is only needed because of a reference to it in the Javadoc,
and can be avoided by explicitly specifying the package instead, which
is how it's referenced in other cases (Constants, FileHeader).

Change-Id: I0c6254a9adf1f52fb8f2c04a858b11696ad264f5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 20:27:12 +09:00
David Pursehouse 04c485b396 Consistently import constants from StandardCharsets as static
Change-Id: I143c242c0e3299323ae166a59947b1195539e6bf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 20:25:14 +09:00
David Pursehouse 52923e9b07 LocalDiskRepositoryTestCase#createRepository: Default auto-close to false
Since 8ed59c5 ("Make TestRepository AutoCloseable", Jan 11, 2019) the
TestRepository class is auto-closeable, but instantiations of it were
not converted to use try-with-resource.

Converting to try-with-resource results, in several cases, in the
repository being closed twice because LocalDiskRepositoryTestCase has
logic to close created repositories in the tearDown method. This results
in several tests emitting a warning to the console:

  close() called when useCnt is already zero

Change the default behavior of the createRepository method to not use
the auto-close logic in LocalDiskRepositoryTestCase, so that thy will
instead be closed (only once) using the AutoCloseable implementation.

Deprecate the method that has the autoClose parameter.

Change-Id: I63d62c9913f9b61271667861dae144e551d358c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 20:09:16 +09:00
David Pursehouse 91b1fe4687 UploadPack: Suppress false-positive resource leak warning
Change-Id: Ida09cabb11740e6752a6f079d0528d38021fa2dd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:41:59 +09:00
David Pursehouse 9b2779925c PushConnectionTest: Open TestRepository in try-with-resource
Change-Id: I539b3acea8da914fc745e54b0bf104cf344c181c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:34:21 +09:00
David Pursehouse d7f4e6d1a1 MergerTest: Open TestRepository in try-with-resource
Change-Id: I1c4bd2fd5f0ad7112bd3ebe1506de3cf51231b36
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:33:04 +09:00
David Pursehouse babdae6412 MergeCommandTest: Open TestRepository in try-with-resource
Change-Id: If620f6a98c5e8436a3edb4ee365ec02f41d0ea6a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:29:33 +09:00
David Pursehouse 5d9c78e471 PackWriterTest: Open TestRepository in try-with-resource
Change-Id: Ia4202c860b851bef5db72ea6781b3e6a32484e08
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:28:10 +09:00
David Pursehouse 6efe3612a7 ReceivePackAdvertiseRefsHookTest: Open TestRepository in try-with-resource
Change-Id: I7ab1de3516ac542821275add908ee70c427d781b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:28:10 +09:00
David Pursehouse a2455e9e40 SubmoduleStatusTest: Open TestRepository in try-with-resource
Change-Id: Iebb6abd35fa5b084a4c044e416a448785a3c9291
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:13:43 +09:00
David Pursehouse 43719e73c7 UploadPackTest: Open TestRepository in try-with-resource
Change-Id: Id37a07b00584aa8a884fa11cd6f42a16b44e77f3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:11:30 +09:00
David Pursehouse b6fe0abc4c PackParserTest: Open TestRepository in try-with-resource
Change-Id: Ie3521f40ac80bc58df95f9f5dc79d51b29380461
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:08:01 +09:00
David Pursehouse 5ac044abc0 SmartClientSmartServerTest: Open TestRepository in try-with-resource
Change-Id: If1351920398f574b5b93be55868c157c3cd15290
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 17:02:34 +09:00
David Pursehouse 1a2db96c79 Stop using deprecated methods of RemoteSetUrlCommand/RemoteRemoveCommand
Change-Id: I5234474b359a32bdae501b181f0726be2af1ec6a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 15:12:45 +09:00
David Pursehouse 283830a643 SmartClientSmartServerTest: Stop using deprecated Repository#hasObject
Change-Id: I75d1105934aeaac89476603e15cf642a65a3acbe
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 15:04:53 +09:00
David Pursehouse fb7b94313a DumbClientSmartServerTest: Open TestRepository in try-with-resource
Change-Id: Ica172a85ec9b7da1416ff1b22699809f2c8c9df7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 15:00:08 +09:00
David Pursehouse 4635f38c09 DumbClientDumbServerTest: Open TestRepository in try-with-resource
Change-Id: Iaf339ae739689d4528a079776d6e945ba9006368
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 14:58:35 +09:00
David Pursehouse 7844b39966 DirCacheCheckoutTest: Open TestRepository in try-with-resource
Change-Id: Iaf18ce230d6bf9b8bcb1895dd1bd3e4eb267de10
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 14:55:47 +09:00
David Pursehouse b465657238 HttpTestCase#fsck: Open TestRepository in try-with-resource
Change-Id: Ibda8c9970322871abf0fcf1244977bed04eaedd2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-01-20 14:52:09 +09:00