Fix resource leak warning in GetPatch#apply
Change-Id: I37d7cb29cff15c78a33d5beac7296ed10fb85f1b
This commit is contained in:
@@ -66,6 +66,7 @@ public class GetPatch implements RestReadView<RevisionResource> {
|
||||
boolean close = true;
|
||||
try {
|
||||
final RevWalk rw = new RevWalk(repo);
|
||||
BinaryResult bin = null;
|
||||
try {
|
||||
final RevCommit commit = rw.parseCommit(rsrc.getPatchSet().commitId());
|
||||
RevCommit[] parents = commit.getParents();
|
||||
@@ -77,7 +78,7 @@ public class GetPatch implements RestReadView<RevisionResource> {
|
||||
final RevCommit base = parents[0];
|
||||
rw.parseBody(base);
|
||||
|
||||
BinaryResult bin =
|
||||
bin =
|
||||
new BinaryResult() {
|
||||
@Override
|
||||
public void writeTo(OutputStream out) throws IOException {
|
||||
@@ -135,6 +136,7 @@ public class GetPatch implements RestReadView<RevisionResource> {
|
||||
} finally {
|
||||
if (close) {
|
||||
rw.close();
|
||||
bin.close();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user