From 31938b662cab920e2f162d5cad442d50487ec415 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Sun, 2 Jun 2024 12:02:01 +0100 Subject: [PATCH] format --- .../api/misc/FakeScanControllerWIP.java | 3 +- .../software/SPDF/utils/PDFToFile.java | 40 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java index ed168f5d..d4c4ce05 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java +++ b/src/main/java/stirling/software/SPDF/controller/api/misc/FakeScanControllerWIP.java @@ -137,8 +137,7 @@ public class FakeScanControllerWIP { // Normalize the kernel for (int i = 0; i < data.length; i++) { - if(sum != 0) - data[i] /= sum; + if (sum != 0) data[i] /= sum; } Kernel kernel = new Kernel(size, size, data); diff --git a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java index 2b1d6f7d..7c419220 100644 --- a/src/main/java/stirling/software/SPDF/utils/PDFToFile.java +++ b/src/main/java/stirling/software/SPDF/utils/PDFToFile.java @@ -22,11 +22,11 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; import io.github.pixee.security.Filenames; -import stirling.software.SPDF.controller.web.AccountWebController; + import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult; public class PDFToFile { - private static final Logger logger = LoggerFactory.getLogger(PDFToFile.class); + private static final Logger logger = LoggerFactory.getLogger(PDFToFile.class); public ResponseEntity processPdfToHtml(MultipartFile inputFile) throws IOException, InterruptedException { @@ -163,25 +163,25 @@ public class PDFToFile { fileBytes = FileUtils.readFileToByteArray(outputFile); } else { // Return output files in a ZIP archive - fileName = pdfBaseName + "To" + outputFormat + ".zip"; - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - try (ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream)) { - for (File outputFile : outputFiles) { - ZipEntry entry = new ZipEntry(outputFile.getName()); - zipOutputStream.putNextEntry(entry); - try (FileInputStream fis = new FileInputStream(outputFile)) { - IOUtils.copy(fis, zipOutputStream); - } catch (IOException e) { - logger.error("Exception writing zip entry", e); - } - - zipOutputStream.closeEntry(); - } - } catch (IOException e) { - logger.error("Exception writing zip", e); - } + fileName = pdfBaseName + "To" + outputFormat + ".zip"; + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + try (ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream)) { + for (File outputFile : outputFiles) { + ZipEntry entry = new ZipEntry(outputFile.getName()); + zipOutputStream.putNextEntry(entry); + try (FileInputStream fis = new FileInputStream(outputFile)) { + IOUtils.copy(fis, zipOutputStream); + } catch (IOException e) { + logger.error("Exception writing zip entry", e); + } - fileBytes = byteArrayOutputStream.toByteArray(); + zipOutputStream.closeEntry(); + } + } catch (IOException e) { + logger.error("Exception writing zip", e); + } + + fileBytes = byteArrayOutputStream.toByteArray(); } } finally {