From 559f5e734f34721ecad15c2682bcb6e48a0f25d6 Mon Sep 17 00:00:00 2001 From: Matthias Keck Date: Wed, 4 Dec 2024 07:20:56 +0100 Subject: [PATCH 1/6] Upgrade library versions Fixes: SIRI-1036 --- pom.xml | 26 +++++-------------- .../java/sirius/web/data/ExcelExport.java | 6 ++++- .../web/templates/pdf/InlinedSvgElement.java | 4 +-- .../pdf/handlers/PdfReplaceHandler.java | 2 +- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 78d4553be..e2525bacc 100644 --- a/pom.xml +++ b/pom.xml @@ -97,14 +97,14 @@ org.xhtmlrenderer flying-saucer-pdf - 9.8.0 + 9.11.1 org.jsoup jsoup - 1.17.2 + 1.18.3 @@ -118,30 +118,18 @@ org.apache.poi poi - 5.2.5 + 5.3.0 org.apache.poi poi-ooxml - 5.2.5 - - - org.apache.commons - commons-compress - - - - - - org.apache.commons - commons-compress - 1.26.1 + 5.3.0 com.github.pjfanning excel-streaming-reader - 4.3.1 + 5.0.2 com.h2database @@ -154,7 +142,7 @@ io.swagger.core.v3 swagger-annotations - 2.2.22 + 2.2.26 @@ -170,7 +158,7 @@ io.netty netty-bom - 4.1.109.Final + 4.1.115.Final pom import diff --git a/src/main/java/sirius/web/data/ExcelExport.java b/src/main/java/sirius/web/data/ExcelExport.java index 8c68def58..6cecec26b 100644 --- a/src/main/java/sirius/web/data/ExcelExport.java +++ b/src/main/java/sirius/web/data/ExcelExport.java @@ -563,7 +563,11 @@ public void writeToStream(OutputStream stream) { throw Exceptions.handle(e); } finally { if (workbook instanceof SXSSFWorkbook sxssfWorkbook) { - sxssfWorkbook.dispose(); + try { + sxssfWorkbook.close(); + } catch (IOException e) { + throw Exceptions.handle(e); + } } } } diff --git a/src/main/java/sirius/web/templates/pdf/InlinedSvgElement.java b/src/main/java/sirius/web/templates/pdf/InlinedSvgElement.java index b01c8042d..796e445d5 100644 --- a/src/main/java/sirius/web/templates/pdf/InlinedSvgElement.java +++ b/src/main/java/sirius/web/templates/pdf/InlinedSvgElement.java @@ -68,10 +68,10 @@ public void paint(RenderingContext renderingContext, ITextOutputDevice outputDev graphics.dispose(); PageBox page = renderingContext.getPage(); - float x = (float) blockBox.getAbsX() + page.getMarginBorderPadding(renderingContext, CalculatedStyle.LEFT); + float x = (float) blockBox.getAbsX() + page.getMarginBorderPadding(renderingContext, CalculatedStyle.Edge.LEFT); float y = (float) (page.getBottom() - (blockBox.getAbsY() + cssHeight)) + page.getMarginBorderPadding( renderingContext, - CalculatedStyle.BOTTOM); + CalculatedStyle.Edge.BOTTOM); x /= outputDevice.getDotsPerPoint(); y /= outputDevice.getDotsPerPoint(); diff --git a/src/main/java/sirius/web/templates/pdf/handlers/PdfReplaceHandler.java b/src/main/java/sirius/web/templates/pdf/handlers/PdfReplaceHandler.java index cff99a21f..6e2d424b7 100644 --- a/src/main/java/sirius/web/templates/pdf/handlers/PdfReplaceHandler.java +++ b/src/main/java/sirius/web/templates/pdf/handlers/PdfReplaceHandler.java @@ -95,7 +95,7 @@ protected FSImage resizeImage(FSImage image, int cssWidth, int cssHeight) { Tuple newSize = computeResizeBox(cssWidth, cssHeight, image); if (newSize != null) { - image.scale(newSize.getFirst(), newSize.getSecond()); + return image.scale(newSize.getFirst(), newSize.getSecond()); } } From 79fdcfe6a7e068a780a93a6b8719afc7c8880fd4 Mon Sep 17 00:00:00 2001 From: Matthias Keck Date: Wed, 4 Dec 2024 07:27:55 +0100 Subject: [PATCH 2/6] Removes not required annotation Fixes: SIRI-1036 --- .../sirius/web/templates/pdf/handlers/PdfReplaceHandlerTest.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/kotlin/sirius/web/templates/pdf/handlers/PdfReplaceHandlerTest.kt b/src/test/kotlin/sirius/web/templates/pdf/handlers/PdfReplaceHandlerTest.kt index eb5bd709f..9eb98fddc 100644 --- a/src/test/kotlin/sirius/web/templates/pdf/handlers/PdfReplaceHandlerTest.kt +++ b/src/test/kotlin/sirius/web/templates/pdf/handlers/PdfReplaceHandlerTest.kt @@ -15,7 +15,6 @@ import org.xhtmlrenderer.pdf.ITextFSImage import sirius.kernel.SiriusExtension import kotlin.test.assertEquals -@ExtendWith(SiriusExtension::class) class PdfReplaceHandlerTest { @Test From a4b4403963a8d295e277bb8514e1bf2b4e7e42a8 Mon Sep 17 00:00:00 2001 From: Sascha Bieberstein Date: Wed, 4 Dec 2024 08:36:15 +0100 Subject: [PATCH 3/6] Switch project to Java 23 Fixes: SIRI-1030 --- .drone.yml | 10 +++++----- pom.xml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 77b239f79..88090beb1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,7 +17,7 @@ clone: steps: - name: compile - image: scireum/sirius-build-jdk22 + image: scireum/sirius-build-jdk23 commands: - mvn clean compile volumes: *scireum_volumes @@ -28,7 +28,7 @@ steps: - push - name: cron_unit_tests - image: scireum/sirius-build-jdk22 + image: scireum/sirius-build-jdk23 commands: - mvn clean test -Dsun.net.http.allowRestrictedHeaders=true volumes: *scireum_volumes @@ -48,7 +48,7 @@ steps: - cron - name: test - image: scireum/sirius-build-jdk22 + image: scireum/sirius-build-jdk23 commands: - mvn clean test -Dtest.excluded.groups=nightly -Dsun.net.http.allowRestrictedHeaders=true volumes: *scireum_volumes @@ -57,7 +57,7 @@ steps: - pull_request - name: deploy - image: scireum/sirius-build-jdk22 + image: scireum/sirius-build-jdk23 commands: - sed -i 's/DEVELOPMENT-SNAPSHOT/${DRONE_TAG}/g' pom.xml - mvn clean deploy -DskipTests @@ -77,7 +77,7 @@ steps: - tag - name: sonar - image: scireum/sirius-build-jdk22 + image: scireum/sirius-build-jdk23 commands: - sed -i 's/DEVELOPMENT-SNAPSHOT/${DRONE_TAG}/g' pom.xml - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report sonar:sonar -Dsonar.projectKey=${DRONE_REPO_NAME} -Dsun.net.http.allowRestrictedHeaders=true diff --git a/pom.xml b/pom.xml index e2525bacc..b90bf00d9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.scireum sirius-parent - 12.1.1 + 13.0.0 sirius-web DEVELOPMENT-SNAPSHOT From fb5ed7782d5d29bad7e41d77c09f37943ece666f Mon Sep 17 00:00:00 2001 From: Matthias Keck Date: Wed, 4 Dec 2024 08:41:18 +0100 Subject: [PATCH 4/6] Renames exception variables for clarity Fixes: SIRI-1036 --- src/main/java/sirius/web/data/ExcelExport.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/sirius/web/data/ExcelExport.java b/src/main/java/sirius/web/data/ExcelExport.java index 6cecec26b..88ed24870 100644 --- a/src/main/java/sirius/web/data/ExcelExport.java +++ b/src/main/java/sirius/web/data/ExcelExport.java @@ -125,8 +125,8 @@ public ImageCell(byte[] fileData, int colWidthInPixel, String fileName) { this.colWidthInPixel = colWidthInPixel; try { determineImageSize(fileData); - } catch (IOException e) { - throw Exceptions.handle(e); + } catch (IOException exception) { + throw Exceptions.handle(exception); } } @@ -382,8 +382,8 @@ private void addCell(Row row, Object obj, int columnIndex, CellStyle style) { .collect(Collectors.joining(", "))); return; } - } catch (SQLException e) { - Exceptions.ignore(e); + } catch (SQLException exception) { + Exceptions.ignore(exception); } } cell.setCellValue(createRichTextString(obj.toString())); @@ -559,14 +559,14 @@ public void writeToStream(OutputStream stream) { } workbook.write(out); } - } catch (IOException e) { - throw Exceptions.handle(e); + } catch (IOException exception) { + throw Exceptions.handle(exception); } finally { if (workbook instanceof SXSSFWorkbook sxssfWorkbook) { try { sxssfWorkbook.close(); - } catch (IOException e) { - throw Exceptions.handle(e); + } catch (IOException exception) { + throw Exceptions.handle(exception); } } } From ea0896d362d560bdaaf3e6d307cf414af75496e2 Mon Sep 17 00:00:00 2001 From: Matthias Keck Date: Wed, 4 Dec 2024 08:52:27 +0100 Subject: [PATCH 5/6] Upgrade version Fixes: SIRI-1036 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b90bf00d9..6710afb4b 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ Provides a modern and scalable web server as SIRIUS module - dev-43.1.0 + dev-44.0.0 @@ -97,7 +97,7 @@ org.xhtmlrenderer flying-saucer-pdf - 9.11.1 + 9.11.2 From 01063b9b69daac4f260e65ca7befd0c6630e2bb2 Mon Sep 17 00:00:00 2001 From: Matthias Keck Date: Wed, 4 Dec 2024 10:16:01 +0100 Subject: [PATCH 6/6] Fixes all api breakages of org.xhtmlrenderer.extend.FSImage#scale - not only those covered by tests Fixes: SIRI-1036 --- .../web/templates/pdf/handlers/BarcodePdfReplaceHandler.java | 2 +- .../web/templates/pdf/handlers/QrCodePdfReplaceHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/sirius/web/templates/pdf/handlers/BarcodePdfReplaceHandler.java b/src/main/java/sirius/web/templates/pdf/handlers/BarcodePdfReplaceHandler.java index 26843c85e..03245206c 100644 --- a/src/main/java/sirius/web/templates/pdf/handlers/BarcodePdfReplaceHandler.java +++ b/src/main/java/sirius/web/templates/pdf/handlers/BarcodePdfReplaceHandler.java @@ -49,7 +49,7 @@ public FSImage resolveUri(String uri, UserAgentCallback userAgentCallback, int c FSImage fsImage = new ITextFSImage(com.lowagie.text.Image.getInstance(awtImage, Color.WHITE, true)); if (cssWidth != -1 || cssHeight != -1) { - fsImage.scale(cssWidth, cssHeight); + return fsImage.scale(cssWidth, cssHeight); } return fsImage; diff --git a/src/main/java/sirius/web/templates/pdf/handlers/QrCodePdfReplaceHandler.java b/src/main/java/sirius/web/templates/pdf/handlers/QrCodePdfReplaceHandler.java index b67bec19c..bba1ce822 100644 --- a/src/main/java/sirius/web/templates/pdf/handlers/QrCodePdfReplaceHandler.java +++ b/src/main/java/sirius/web/templates/pdf/handlers/QrCodePdfReplaceHandler.java @@ -51,7 +51,7 @@ public FSImage resolveUri(String uri, UserAgentCallback userAgentCallback, int c FSImage fsImage = new ITextFSImage(Image.getInstance(MatrixToImageWriter.toBufferedImage(matrix), Color.WHITE)); if (cssWidth != -1 || cssHeight != -1) { - fsImage.scale(cssWidth, cssHeight); + return fsImage.scale(cssWidth, cssHeight); } return fsImage;