This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 615a87a18e Improved: Update to Apache Tika 3.0.0 (OFBIZ-13155)
615a87a18e is described below

commit 615a87a18e1714288ce2d97f81a2484cf70f137e
Author: Jacques Le Roux <[email protected]>
AuthorDate: Sat Dec 20 11:20:06 2025 +0100

    Improved: Update to Apache Tika 3.0.0 (OFBIZ-13155)
    
    Complex: more information on the Jira
    
    Thanks: Gil Portenseigne for his help
---
 README.adoc                                                  |  9 +++++++++
 dependencies.gradle                                          | 12 +++++++-----
 .../main/java/org/apache/ofbiz/security/SecuredUpload.java   |  6 +++++-
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/README.adoc b/README.adoc
index e226c5d9c1..67e06761d6 100644
--- a/README.adoc
+++ b/README.adoc
@@ -609,6 +609,15 @@ verbose:
 Run a test case, in this example the component is "entity" and the case name is
 "entity-tests"
 
+[WARNING]
+====
+If the test fail and you see in the log that the test lacks data in the DB,
+verify that a *TestData.xml is not required in the *Test.xml where the test 
case is defined.
+In this case you can't use the test case, you need to use the test suite
+
+====
+
+
 `gradlew "ofbiz --test component=entity --test suitename=entitytests --test 
case=entity-query-tests"`
 
 [[execute-an-integration-test-case-in-debug-mode-with-verbose-log]]
diff --git a/dependencies.gradle b/dependencies.gradle
index d1dc36dd10..5b7cdf4957 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -50,14 +50,15 @@ dependencies {
     implementation 'org.apache.logging.log4j:log4j-api:2.24.2' // the API of 
log4j 2
     implementation 'org.apache.logging.log4j:log4j-core:2.24.2' // Somehow 
needed by Buildbot to compile OFBizDynamicThresholdFilter.java
     implementation 'org.apache.poi:poi:5.3.0'
-    implementation 'org.apache.pdfbox:pdfbox:2.0.33' // 3.0.1 does not compile
+    implementation 'org.apache.pdfbox:pdfbox:3.0.5'
+    implementation 'org.apache.pdfbox:pdfbox-io:3.0.5'
     implementation 'org.apache.shiro:shiro-core:1.13.0' // Got "Exception in 
thread "main" java.lang.UnsupportedOperationException: Cannot create a hash 
with the given algorithm: argon2" with 2.0.2 in integration tests
     implementation 'org.apache.shiro:shiro-crypto-cipher:2.0.2'
     implementation 'org.apache.sshd:sshd-core:2.14.0'
     implementation 'org.apache.sshd:sshd-sftp:2.14.0'
-    implementation 'org.apache.tika:tika-core:2.9.2'     // To be compatible 
with tika-parser-pdf-module below
-    implementation 'org.apache.tika:tika-parsers:2.9.2' // To be compatible 
with tika-parser-pdf-module below
-    implementation 'org.apache.tika:tika-parser-pdf-module:2.9.2' // > 2.9.2 
does not compile, see OFBIZ-13155
+    implementation 'org.apache.tika:tika-core:3.2.3'
+    implementation 'org.apache.tika:tika-parsers:3.2.3'
+    implementation 'org.apache.tika:tika-parser-pdf-module:3.2.3'
     implementation 'org.apache.cxf:cxf-rt-frontend-jaxrs:4.1.3'
     implementation 'org.apache.tomcat:tomcat-catalina-ha:10.1.47' // Remember 
to change the version number (10 now) in javadoc block if needed.
     implementation 'org.apache.tomcat:tomcat-jasper:10.1.47'
@@ -65,7 +66,7 @@ dependencies {
     implementation 'org.apache.xmlgraphics:batik-anim:1.18'
     implementation 'org.apache.xmlgraphics:batik-util:1.18'
     implementation 'org.apache.xmlgraphics:batik-bridge:1.18'
-    implementation 'org.apache.xmlgraphics:fop:2.3' // NOTE: since 2.4 
dependencies are messed up. See 
https://github.com/moqui/moqui-fop/blob/master/build.gradle
+    implementation 'org.apache.xmlgraphics:fop:2.11' // NOTE: since 2.4 
dependencies are messed up. See 
https://github.com/moqui/moqui-fop/blob/master/build.gradle
     implementation 'org.clojure:clojure:1.12.0'
     implementation 'org.apache.groovy:groovy-all:5.0.0-alpha-11'
     implementation 'org.freemarker:freemarker:2.3.34' // Remember to change 
the version number in FreeMarkerWorker class when upgrading. See OFBIZ-10019 if 
>= 2.4
@@ -92,6 +93,7 @@ dependencies {
     runtimeOnly 'javax.xml.soap:javax.xml.soap-api:1.4.0'
     runtimeOnly 'net.sf.barcode4j:barcode4j-fop-ext:2.1'
     runtimeOnly 'net.sf.barcode4j:barcode4j:2.1'
+    runtimeOnly 'org.apache.avalon.framework:avalon-framework-impl:4.3.1'
     runtimeOnly 'org.apache.axis2:axis2-transport-http:1.8.2'
     runtimeOnly 'org.apache.axis2:axis2-transport-local:1.8.2'
     runtimeOnly 'org.apache.derby:derby:10.16.1.1' // 10.17.x.x requires Java 
21
diff --git 
a/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java 
b/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
index 2cc62dbba8..f7695de339 100644
--- 
a/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
+++ 
b/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
@@ -84,7 +84,10 @@ import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.base.util.UtilXml;
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.pdfbox.io.RandomAccessReadBufferedFile;
+import org.apache.pdfbox.Loader;
 import org.apache.pdfbox.pdmodel.PDDocument;
+//import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
 import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
 import org.apache.tika.Tika;
@@ -687,7 +690,8 @@ public class SecuredUpload {
             }
             // OK no JS code, pass to check 2: detect if the document has any 
embedded files
             PDEmbeddedFilesNameTreeNode efTree = null;
-            try (PDDocument pdDocument = PDDocument.load(file)) {
+            try (PDDocument pdDocument = Loader.loadPDF(new 
RandomAccessReadBufferedFile(fileName))) {
+                    //PDDocument.load(file)) {
                 PDDocumentNameDictionary names = new 
PDDocumentNameDictionary(pdDocument.getDocumentCatalog());
                 efTree = names.getEmbeddedFiles();
             }

Reply via email to