Skip to content

Commit 9ecd7d1

Browse files
authored
📁 pre-commit
Signed-off-by: exadev[bot] <exadev[bot]@users.noreply.github.com>
1 parent 4af3637 commit 9ecd7d1

File tree

6 files changed

+59
-52
lines changed

6 files changed

+59
-52
lines changed

app/common/src/main/java/stirling/software/common/util/PdfUtils.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ public boolean pageCount(PDDocument pdfDocument, int pageCount, String comparato
636636
case "equal" -> actualPageCount == pageCount;
637637
case "less" -> actualPageCount < pageCount;
638638
default ->
639-
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
639+
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
640640
};
641641
}
642642

@@ -659,15 +659,9 @@ public boolean pageSize(PDDocument pdfDocument, String expectedPageSize) throws
659659
return actualPageWidth == expectedPageWidth && actualPageHeight == expectedPageHeight;
660660
}
661661

662-
/**
663-
* Key for storing the dimensions of a rendered image in a map.
664-
*/
665-
private record PdfRenderSettingsKey(float mediaBoxWidth, float mediaBoxHeight, int rotation) {
666-
}
662+
/** Key for storing the dimensions of a rendered image in a map. */
663+
private record PdfRenderSettingsKey(float mediaBoxWidth, float mediaBoxHeight, int rotation) {}
667664

668-
/**
669-
* Value for storing the dimensions of a rendered image in a map.
670-
*/
671-
private record PdfImageDimensionValue(int width, int height) {
672-
}
665+
/** Value for storing the dimensions of a rendered image in a map. */
666+
private record PdfImageDimensionValue(int width, int height) {}
673667
}

app/core/src/main/java/stirling/software/SPDF/UI/impl/LoadingWindow.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ private void checkAndRefreshExplorer() {
227227
if (!existingPids
228228
.contains(
229229
pid)) {
230-
log.debug("Found new explorer.exe with PID: {}", pid);
230+
log.debug(
231+
"Found new explorer.exe with PID: {}",
232+
pid);
231233
ProcessBuilder
232234
killProcess =
233235
new ProcessBuilder(
@@ -245,7 +247,9 @@ private void checkAndRefreshExplorer() {
245247
2,
246248
TimeUnit
247249
.SECONDS);
248-
log.debug("Explorer process terminated: {}", pid);
250+
log.debug(
251+
"Explorer process terminated: {}",
252+
pid);
249253
}
250254
}
251255
}

app/core/src/main/java/stirling/software/SPDF/controller/api/filters/FilterController.java

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ public ResponseEntity<byte[]> pageCount(@ModelAttribute PDFComparisonAndCount re
8787
PDDocument document = pdfDocumentFactory.load(inputFile);
8888
int actualPageCount = document.getNumberOfPages();
8989
// Perform the comparison
90-
boolean valid = switch (comparator) {
91-
case "Greater" -> actualPageCount > pageCount;
92-
case "Equal" -> actualPageCount == pageCount;
93-
case "Less" -> actualPageCount < pageCount;
94-
default ->
95-
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
96-
};
90+
boolean valid =
91+
switch (comparator) {
92+
case "Greater" -> actualPageCount > pageCount;
93+
case "Equal" -> actualPageCount == pageCount;
94+
case "Less" -> actualPageCount < pageCount;
95+
default ->
96+
throw ExceptionUtils.createInvalidArgumentException(
97+
"comparator", comparator);
98+
};
9799

98100
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
99101
return null;
@@ -123,13 +125,15 @@ public ResponseEntity<byte[]> pageSize(@ModelAttribute PageSizeRequest request)
123125
float standardArea = standardSize.getWidth() * standardSize.getHeight();
124126

125127
// Perform the comparison
126-
boolean valid = switch (comparator) {
127-
case "Greater" -> actualArea > standardArea;
128-
case "Equal" -> actualArea == standardArea;
129-
case "Less" -> actualArea < standardArea;
130-
default ->
131-
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
132-
};
128+
boolean valid =
129+
switch (comparator) {
130+
case "Greater" -> actualArea > standardArea;
131+
case "Equal" -> actualArea == standardArea;
132+
case "Less" -> actualArea < standardArea;
133+
default ->
134+
throw ExceptionUtils.createInvalidArgumentException(
135+
"comparator", comparator);
136+
};
133137

134138
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
135139
return null;
@@ -149,13 +153,15 @@ public ResponseEntity<byte[]> fileSize(@ModelAttribute FileSizeRequest request)
149153
long actualFileSize = inputFile.getSize();
150154

151155
// Perform the comparison
152-
boolean valid = switch (comparator) {
153-
case "Greater" -> actualFileSize > fileSize;
154-
case "Equal" -> actualFileSize == fileSize;
155-
case "Less" -> actualFileSize < fileSize;
156-
default ->
157-
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
158-
};
156+
boolean valid =
157+
switch (comparator) {
158+
case "Greater" -> actualFileSize > fileSize;
159+
case "Equal" -> actualFileSize == fileSize;
160+
case "Less" -> actualFileSize < fileSize;
161+
default ->
162+
throw ExceptionUtils.createInvalidArgumentException(
163+
"comparator", comparator);
164+
};
159165

160166
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
161167
return null;
@@ -179,13 +185,15 @@ public ResponseEntity<byte[]> pageRotation(@ModelAttribute PageRotationRequest r
179185
int actualRotation = firstPage.getRotation();
180186

181187
// Perform the comparison
182-
boolean valid = switch (comparator) {
183-
case "Greater" -> actualRotation > rotation;
184-
case "Equal" -> actualRotation == rotation;
185-
case "Less" -> actualRotation < rotation;
186-
default ->
187-
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
188-
};
188+
boolean valid =
189+
switch (comparator) {
190+
case "Greater" -> actualRotation > rotation;
191+
case "Equal" -> actualRotation == rotation;
192+
case "Less" -> actualRotation < rotation;
193+
default ->
194+
throw ExceptionUtils.createInvalidArgumentException(
195+
"comparator", comparator);
196+
};
189197

190198
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
191199
return null;

app/core/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424
import stirling.software.SPDF.model.api.misc.MetadataRequest;
2525
import stirling.software.common.service.CustomPDFDocumentFactory;
26+
import stirling.software.common.service.PdfMetadataService;
2627
import stirling.software.common.util.GeneralUtils;
2728
import stirling.software.common.util.RegexPatternUtils;
28-
import stirling.software.common.service.PdfMetadataService;
2929
import stirling.software.common.util.WebResponseUtils;
3030
import stirling.software.common.util.propertyeditor.StringToMapPropertyEditor;
3131

app/core/src/main/java/stirling/software/SPDF/controller/api/security/WatermarkController.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,15 @@ private void addTextWatermark(
170170
throws IOException {
171171
String resourceDir = "";
172172
PDFont font = new PDType1Font(Standard14Fonts.FontName.HELVETICA);
173-
resourceDir = switch (alphabet) {
174-
case "arabic" -> "static/fonts/NotoSansArabic-Regular.ttf";
175-
case "japanese" -> "static/fonts/Meiryo.ttf";
176-
case "korean" -> "static/fonts/malgun.ttf";
177-
case "chinese" -> "static/fonts/SimSun.ttf";
178-
case "thai" -> "static/fonts/NotoSansThai-Regular.ttf";
179-
default -> "static/fonts/NotoSans-Regular.ttf";
180-
};
173+
resourceDir =
174+
switch (alphabet) {
175+
case "arabic" -> "static/fonts/NotoSansArabic-Regular.ttf";
176+
case "japanese" -> "static/fonts/Meiryo.ttf";
177+
case "korean" -> "static/fonts/malgun.ttf";
178+
case "chinese" -> "static/fonts/SimSun.ttf";
179+
case "thai" -> "static/fonts/NotoSansThai-Regular.ttf";
180+
default -> "static/fonts/NotoSans-Regular.ttf";
181+
};
181182

182183
ClassPathResource classPathResource = new ClassPathResource(resourceDir);
183184
String fileExtension = resourceDir.substring(resourceDir.lastIndexOf("."));

app/core/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ public String getFormatFromExtension(String extension) {
288288
case "eot" -> "embedded-opentype";
289289
case "svg" -> "svg";
290290
default ->
291-
// or throw an exception if an unexpected extension is encountered
292-
"";
291+
// or throw an exception if an unexpected extension is encountered
292+
"";
293293
};
294294
}
295295

0 commit comments

Comments
 (0)