Merge changes I343cc3cf,I9dedf61b

* changes:
  Avoid error-prone warning
  Fix unused exception error-prone warning
This commit is contained in:
Matthias Sohn 2023-02-01 16:52:37 -05:00 committed by Gerrit Code Review @ Eclipse.org
commit 8bd960bf2b
4 changed files with 11 additions and 11 deletions

View File

@ -90,7 +90,7 @@ public void testWriteWhenGc() throws Exception {
bb.update(tip);
assertTrue(gc.shouldWriteCommitGraphWhenGc());
gc.gc();
gc.gc().get();
File graphFile = new File(repo.getObjectsDirectory(),
Constants.INFO_COMMIT_GRAPH);
assertGraphFile(graphFile);
@ -103,7 +103,7 @@ public void testDefaultWriteWhenGc() throws Exception {
bb.update(tip);
assertFalse(gc.shouldWriteCommitGraphWhenGc());
gc.gc();
gc.gc().get();
File graphFile = new File(repo.getObjectsDirectory(),
Constants.INFO_COMMIT_GRAPH);
assertFalse(graphFile.exists());
@ -123,21 +123,21 @@ public void testDisableWriteWhenGc() throws Exception {
config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, true);
gc.gc();
gc.gc().get();
assertFalse(graphFile.exists());
config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_COMMIT_GRAPH, true);
config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, false);
gc.gc();
gc.gc().get();
assertFalse(graphFile.exists());
config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_COMMIT_GRAPH, false);
config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, false);
gc.gc();
gc.gc().get();
assertFalse(graphFile.exists());
}

View File

@ -247,7 +247,7 @@ public void testWindowCursorGetCommitGraph() throws Exception {
assertTrue(curs.getCommitGraph().isEmpty());
commitFile("file.txt", "content", "master");
GC gc = new GC(db);
gc.gc();
gc.gc().get();
assertTrue(curs.getCommitGraph().isPresent());
db.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
@ -286,7 +286,7 @@ public void testGetCommitGraph() throws Exception {
// add commit-graph
commitFile("file.txt", "content", "master");
GC gc = new GC(db);
gc.gc();
gc.gc().get();
File file = new File(db.getObjectsDirectory(),
Constants.INFO_COMMIT_GRAPH);
assertTrue(file.exists());
@ -296,7 +296,7 @@ public void testGetCommitGraph() throws Exception {
// update commit-graph
commitFile("file2.txt", "content", "master");
gc.gc();
gc.gc().get();
assertEquals(2, dir.getCommitGraph().get().getCommitCnt());
// delete commit-graph
@ -311,7 +311,7 @@ public void testGetCommitGraph() throws Exception {
assertTrue(dir.getCommitGraph().isEmpty());
// add commit-graph again
gc.gc();
gc.gc().get();
assertTrue(dir.getCommitGraph().isPresent());
assertEquals(2, dir.getCommitGraph().get().getCommitCnt());
}

View File

@ -309,7 +309,7 @@ void enableAndWriteCommitGraph() throws Exception {
db.getConfig().setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, true);
GC gc = new GC(db);
gc.gc();
gc.gc().get();
}
private void reinitializeRevWalk() {

View File

@ -254,7 +254,7 @@ long getSize(WindowCursor curs, AnyObjectId id) throws IOException {
// refresh directory to work around NFS caching issue
}
return getSizeWithoutRefresh(curs, id);
} catch (FileNotFoundException e) {
} catch (FileNotFoundException unused) {
if (fileFor(id).exists()) {
throw noFile;
}