Skip to content

Commit ffe5856

Browse files
authored
Merge pull request #167 from mendix/run/4952-upgrade-dependencies
[RUN-4952] Upgrade dependencies
2 parents 81debd2 + 69754fb commit ffe5856

6 files changed

Lines changed: 308 additions & 18 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mxMarketplace {
2525
moduleLicense = 'Apache V2'
2626
appDirectory = "src/CommunityCommons"
2727
versionPathPrefix = "_Version " // the path prefix within the module to the version folder
28-
includeFiles = ["$mprDir/License.txt", "$mprDir/SiemensMendixCommunityCommons__11.4.0__READMEOSS.html"]
28+
includeFiles = ["$mprDir/License.txt", "$mprDir/SiemensMendixCommunityCommons__11.5.0__READMEOSS.html"]
2929
syncJavaDependenciesBeforeBuild = true
3030
}
3131

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=11.4.1-SNAPSHOT
1+
version=11.5.0-SNAPSHOT
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- We upgraded guava to 33.5.0-jre
2+
- We upgraded owasp-java-html-sanitizer to 20240325.1
3+
- We upgraded commons-io to 2.21.0
4+
- We upgraded pdfbox to 3.0.6
5+
- We upgraded commons-lang3 to 3.20.0
6+
- We upgraded commons-text to 1.14.0
7+
- We added the pdfbox-io 3.0.6 dependency
0 Bytes
Binary file not shown.

src/CommunityCommons/SiemensMendixCommunityCommons__11.4.0__READMEOSS.html renamed to src/CommunityCommons/SiemensMendixCommunityCommons__11.5.0__READMEOSS.html

Lines changed: 289 additions & 11 deletions
Large diffs are not rendered by default.

src/CommunityCommons/javasource/communitycommons/Misc.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
import java.util.concurrent.atomic.AtomicLong;
3737
import java.util.stream.Collectors;
3838
import org.apache.commons.io.IOUtils;
39+
import org.apache.pdfbox.io.RandomAccessRead;
40+
import org.apache.pdfbox.io.RandomAccessReadBuffer;
41+
import org.apache.pdfbox.Loader;
3942
import org.apache.pdfbox.multipdf.Overlay;
4043
import org.apache.pdfbox.multipdf.PDFMergerUtility;
4144
import org.apache.pdfbox.pdmodel.PDDocument;
@@ -629,12 +632,12 @@ public static Language getDefaultLanguage(IContext context) throws CoreException
629632
public static boolean mergePDF(IContext context, List<FileDocument> documents, IMendixObject mergedDocument) throws IOException {
630633
if (getMergeMultiplePdfs_MaxAtOnce() <= 0 || documents.size() <= getMergeMultiplePdfs_MaxAtOnce()) {
631634

632-
List<InputStream> sources = new ArrayList<>();
635+
List<RandomAccessRead> sources = new ArrayList<>();
633636
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
634637
PDFMergerUtility mergePdf = new PDFMergerUtility();
635638

636639
for (FileDocument file : documents) {
637-
InputStream content = Core.getFileDocumentContent(context, file.getMendixObject());
640+
RandomAccessRead content = new RandomAccessReadBuffer(Core.getFileDocumentContent(context, file.getMendixObject()));
638641
sources.add(content);
639642
}
640643
mergePdf.addSources(sources);
@@ -648,7 +651,7 @@ public static boolean mergePDF(IContext context, List<FileDocument> documents, I
648651
} catch (IOException e) {
649652
throw new RuntimeException("Failed to merge documents" + e.getMessage(), e);
650653
} finally { // We cannot use try-with-resources because streams would be prematurely closed
651-
for (InputStream is : sources) {
654+
for (RandomAccessRead is : sources) {
652655
is.close();
653656
}
654657
}
@@ -675,8 +678,10 @@ public static boolean mergePDF(IContext context, List<FileDocument> documents, I
675678
public static boolean overlayPdf(IContext context, IMendixObject generatedDocumentMendixObject, IMendixObject overlayMendixObject, boolean onTopOfContent) throws IOException {
676679
Logging.trace(LOGNODE, "Retrieve generated document");
677680
try (
678-
PDDocument inputDoc = PDDocument.load(Core.getFileDocumentContent(context, generatedDocumentMendixObject));
679-
PDDocument overlayDoc = PDDocument.load(Core.getFileDocumentContent(context, overlayMendixObject));
681+
RandomAccessRead generatedDocumentInput = new RandomAccessReadBuffer(Core.getFileDocumentContent(context, generatedDocumentMendixObject));
682+
RandomAccessRead overlayInput = new RandomAccessReadBuffer(Core.getFileDocumentContent(context, overlayMendixObject));
683+
PDDocument inputDoc = Loader.loadPDF(generatedDocumentInput);
684+
PDDocument overlayDoc = Loader.loadPDF(overlayInput);
680685
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
681686
Logging.trace(LOGNODE, "Overlay PDF start, retrieve overlay PDF");
682687

0 commit comments

Comments
 (0)