github-code-scanning[bot] commented on code in PR #757: URL: https://github.com/apache/incubator-baremaps/pull/757#discussion_r1306431465
########## baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java: ########## @@ -0,0 +1,41 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.baremaps.workflow.tasks; + +import java.io.BufferedInputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import org.apache.baremaps.workflow.Task; +import org.apache.baremaps.workflow.WorkflowContext; +import org.apache.baremaps.workflow.WorkflowException; +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; + +public record DecompressBZip2(Path source, Path target) implements Task { + + @Override + public void execute(WorkflowContext context) throws Exception { + var sourcePath = source.toAbsolutePath(); + try (var zis = + new BZip2CompressorInputStream(new BufferedInputStream(Files.newInputStream(sourcePath)))) { Review Comment: ## Potential input resource leak This BufferedInputStream is not always closed on method exit. [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/789) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
