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;
|
boolean close = true;
|
||||||
try {
|
try {
|
||||||
final RevWalk rw = new RevWalk(repo);
|
final RevWalk rw = new RevWalk(repo);
|
||||||
|
BinaryResult bin = null;
|
||||||
try {
|
try {
|
||||||
final RevCommit commit = rw.parseCommit(rsrc.getPatchSet().commitId());
|
final RevCommit commit = rw.parseCommit(rsrc.getPatchSet().commitId());
|
||||||
RevCommit[] parents = commit.getParents();
|
RevCommit[] parents = commit.getParents();
|
||||||
@@ -77,7 +78,7 @@ public class GetPatch implements RestReadView<RevisionResource> {
|
|||||||
final RevCommit base = parents[0];
|
final RevCommit base = parents[0];
|
||||||
rw.parseBody(base);
|
rw.parseBody(base);
|
||||||
|
|
||||||
BinaryResult bin =
|
bin =
|
||||||
new BinaryResult() {
|
new BinaryResult() {
|
||||||
@Override
|
@Override
|
||||||
public void writeTo(OutputStream out) throws IOException {
|
public void writeTo(OutputStream out) throws IOException {
|
||||||
@@ -135,6 +136,7 @@ public class GetPatch implements RestReadView<RevisionResource> {
|
|||||||
} finally {
|
} finally {
|
||||||
if (close) {
|
if (close) {
|
||||||
rw.close();
|
rw.close();
|
||||||
|
bin.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user