Merge changes Ic555e6e0,Id4cb9a23
* changes: Replace use of deprecated release() method in BlameResult Use try-with-resource to close BlameGenerator
This commit is contained in:
commit
9b9087d47d
|
@ -200,8 +200,7 @@ public BlameCommand reverse(AnyObjectId start, Collection<ObjectId> end)
|
||||||
*/
|
*/
|
||||||
public BlameResult call() throws GitAPIException {
|
public BlameResult call() throws GitAPIException {
|
||||||
checkCallable();
|
checkCallable();
|
||||||
BlameGenerator gen = new BlameGenerator(repo, path);
|
try (BlameGenerator gen = new BlameGenerator(repo, path)) {
|
||||||
try {
|
|
||||||
if (diffAlgorithm != null)
|
if (diffAlgorithm != null)
|
||||||
gen.setDiffAlgorithm(diffAlgorithm);
|
gen.setDiffAlgorithm(diffAlgorithm);
|
||||||
if (textComparator != null)
|
if (textComparator != null)
|
||||||
|
@ -231,8 +230,6 @@ else if (startCommit != null)
|
||||||
return gen.computeBlameResult();
|
return gen.computeBlameResult();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new JGitInternalException(e.getMessage(), e);
|
throw new JGitInternalException(e.getMessage(), e);
|
||||||
} finally {
|
|
||||||
gen.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public static BlameResult create(BlameGenerator gen) throws IOException {
|
||||||
String path = gen.getResultPath();
|
String path = gen.getResultPath();
|
||||||
RawText contents = gen.getResultContents();
|
RawText contents = gen.getResultContents();
|
||||||
if (contents == null) {
|
if (contents == null) {
|
||||||
gen.release();
|
gen.close();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new BlameResult(gen, path, contents);
|
return new BlameResult(gen, path, contents);
|
||||||
|
@ -239,7 +239,7 @@ public void computeAll() throws IOException {
|
||||||
while (gen.next())
|
while (gen.next())
|
||||||
loadFrom(gen);
|
loadFrom(gen);
|
||||||
} finally {
|
} finally {
|
||||||
gen.release();
|
gen.close();
|
||||||
generator = null;
|
generator = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ public int computeNext() throws IOException {
|
||||||
lastLength = gen.getRegionLength();
|
lastLength = gen.getRegionLength();
|
||||||
return gen.getResultStart();
|
return gen.getResultStart();
|
||||||
} else {
|
} else {
|
||||||
gen.release();
|
gen.close();
|
||||||
generator = null;
|
generator = null;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ public void computeRange(int start, int end) throws IOException {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!gen.next()) {
|
if (!gen.next()) {
|
||||||
gen.release();
|
gen.close();
|
||||||
generator = null;
|
generator = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue