[infer] Fix resource leak in ObjectChecker

Bug: 509385
Change-Id: I6b6ff5b721d959eb0708003a40c8f97d6826ac46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2016-12-20 01:08:38 +01:00
parent f30fe13ac9
commit 325cb35ccd
1 changed files with 3 additions and 2 deletions

View File

@ -709,11 +709,12 @@ private int scanPathSegment(byte[] raw, int ptr, int end,
return ptr;
}
@SuppressWarnings("resource")
@Nullable
private ObjectId idFor(int objType, byte[] raw) {
if (skipList != null) {
return new ObjectInserter.Formatter().idFor(objType, raw);
try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
return fmt.idFor(objType, raw);
}
}
return null;
}