Source:
<code>protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = <START> new PacketLineOut(out); <END> packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); if (!uploadArchiveAllowed || !projectControl.allRefsAreVisible()) { throw new Failure(4, "fatal: upload-archive not permitted on this" + "server"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(5, "fatal: reference not found"); } String format = options.format; boolean wasFormatRegistered = registerArchiveFormat(format); try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(format) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(6, "fatal: git api exception, " + e); } finally { if (wasFormatRegistered) { unregisterArchiveFormat(format); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes("UTF-8")); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }</code><technical_language>this support try-with-resources</technical_language>

Target:
protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); ArchiveFormat f = allowedFormats.getExtensions().get("." + options.format); if (f == null) { throw new Failure(3, "fatal: upload-archive not permitted"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(4, "fatal: reference not found"); } if (projectControl.allRefsAreVisible()) { try { ProjectControl projectControl = projectControlFactory.validateFor(project.getNameKey()); if (!canRead(repo, projectControl, treeId)) { throw new Failure(5, "fatal: cannot perform upload-archive operation"); } } catch (NoSuchProjectException e) { throw new Failure(6, "fatal: project not found"); } } if (f == ArchiveFormat.ZIP) { setupZipCompressionLevel(); } try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(f.name()) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(7, "fatal: git api exception, " + e); } finally { if (f == ArchiveFormat.ZIP) { ZipFormat.resetLevel(); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes(UTF_8)); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }