Skip to content

Commit 615a87a

Browse files
committed
Improved: Update to Apache Tika 3.0.0 (OFBIZ-13155)
Complex: more information on the Jira Thanks: Gil Portenseigne for his help
1 parent 03971bd commit 615a87a

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

README.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,15 @@ verbose:
609609
Run a test case, in this example the component is "entity" and the case name is
610610
"entity-tests"
611611

612+
[WARNING]
613+
====
614+
If the test fail and you see in the log that the test lacks data in the DB,
615+
verify that a *TestData.xml is not required in the *Test.xml where the test case is defined.
616+
In this case you can't use the test case, you need to use the test suite
617+
618+
====
619+
620+
612621
`gradlew "ofbiz --test component=entity --test suitename=entitytests --test case=entity-query-tests"`
613622

614623
[[execute-an-integration-test-case-in-debug-mode-with-verbose-log]]

dependencies.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,23 @@ dependencies {
5050
implementation 'org.apache.logging.log4j:log4j-api:2.24.2' // the API of log4j 2
5151
implementation 'org.apache.logging.log4j:log4j-core:2.24.2' // Somehow needed by Buildbot to compile OFBizDynamicThresholdFilter.java
5252
implementation 'org.apache.poi:poi:5.3.0'
53-
implementation 'org.apache.pdfbox:pdfbox:2.0.33' // 3.0.1 does not compile
53+
implementation 'org.apache.pdfbox:pdfbox:3.0.5'
54+
implementation 'org.apache.pdfbox:pdfbox-io:3.0.5'
5455
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
5556
implementation 'org.apache.shiro:shiro-crypto-cipher:2.0.2'
5657
implementation 'org.apache.sshd:sshd-core:2.14.0'
5758
implementation 'org.apache.sshd:sshd-sftp:2.14.0'
58-
implementation 'org.apache.tika:tika-core:2.9.2' // To be compatible with tika-parser-pdf-module below
59-
implementation 'org.apache.tika:tika-parsers:2.9.2' // To be compatible with tika-parser-pdf-module below
60-
implementation 'org.apache.tika:tika-parser-pdf-module:2.9.2' // > 2.9.2 does not compile, see OFBIZ-13155
59+
implementation 'org.apache.tika:tika-core:3.2.3'
60+
implementation 'org.apache.tika:tika-parsers:3.2.3'
61+
implementation 'org.apache.tika:tika-parser-pdf-module:3.2.3'
6162
implementation 'org.apache.cxf:cxf-rt-frontend-jaxrs:4.1.3'
6263
implementation 'org.apache.tomcat:tomcat-catalina-ha:10.1.47' // Remember to change the version number (10 now) in javadoc block if needed.
6364
implementation 'org.apache.tomcat:tomcat-jasper:10.1.47'
6465
implementation 'org.apache.axis2:axis2-kernel:1.8.2'
6566
implementation 'org.apache.xmlgraphics:batik-anim:1.18'
6667
implementation 'org.apache.xmlgraphics:batik-util:1.18'
6768
implementation 'org.apache.xmlgraphics:batik-bridge:1.18'
68-
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
69+
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
6970
implementation 'org.clojure:clojure:1.12.0'
7071
implementation 'org.apache.groovy:groovy-all:5.0.0-alpha-11'
7172
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 {
9293
runtimeOnly 'javax.xml.soap:javax.xml.soap-api:1.4.0'
9394
runtimeOnly 'net.sf.barcode4j:barcode4j-fop-ext:2.1'
9495
runtimeOnly 'net.sf.barcode4j:barcode4j:2.1'
96+
runtimeOnly 'org.apache.avalon.framework:avalon-framework-impl:4.3.1'
9597
runtimeOnly 'org.apache.axis2:axis2-transport-http:1.8.2'
9698
runtimeOnly 'org.apache.axis2:axis2-transport-local:1.8.2'
9799
runtimeOnly 'org.apache.derby:derby:10.16.1.1' // 10.17.x.x requires Java 21

framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@
8484
import org.apache.ofbiz.base.util.UtilXml;
8585
import org.apache.ofbiz.entity.Delegator;
8686
import org.apache.ofbiz.entity.util.EntityUtilProperties;
87+
import org.apache.pdfbox.io.RandomAccessReadBufferedFile;
88+
import org.apache.pdfbox.Loader;
8789
import org.apache.pdfbox.pdmodel.PDDocument;
90+
//import org.apache.pdfbox.pdmodel.PDDocument;
8891
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
8992
import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
9093
import org.apache.tika.Tika;
@@ -687,7 +690,8 @@ private static boolean isValidPdfFile(String fileName) {
687690
}
688691
// OK no JS code, pass to check 2: detect if the document has any embedded files
689692
PDEmbeddedFilesNameTreeNode efTree = null;
690-
try (PDDocument pdDocument = PDDocument.load(file)) {
693+
try (PDDocument pdDocument = Loader.loadPDF(new RandomAccessReadBufferedFile(fileName))) {
694+
//PDDocument.load(file)) {
691695
PDDocumentNameDictionary names = new PDDocumentNameDictionary(pdDocument.getDocumentCatalog());
692696
efTree = names.getEmbeddedFiles();
693697
}

0 commit comments

Comments
 (0)