This is an automated email from the ASF dual-hosted git repository.
tballison pushed a commit to branch docs/4.1.x
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/docs/4.1.x by this push:
new d92eb1d247 TIKA-4984 fix 4.1.x branch (#3388)
d92eb1d247 is described below
commit d92eb1d2473b38e0198f97da74a88f0ed54e81f1
Author: Tim Allison <[email protected]>
AuthorDate: Wed Oct 21 19:44:20 2026 -0400
TIKA-4984 fix 4.1.x branch (#3388)
---
.../tika/pipes/core/DocsExampleConfigsTest.java | 67 ++++++++++++++++++++++
.../test/resources/configs/tika-config-basic.json | 4 +-
.../configs/tika-config-exception-reporting.json | 4 +-
.../configs/tika-config-inference-bindings.json | 4 +-
.../resources/configs/tika-config-passback.json | 4 +-
.../configs/tika-config-shared-server.json | 4 +-
.../configs/tika-config-text-recognizers.json | 4 +-
.../resources/configs/tika-config-uppercasing.json | 4 +-
8 files changed, 88 insertions(+), 7 deletions(-)
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/DocsExampleConfigsTest.java
b/tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/DocsExampleConfigsTest.java
new file mode 100644
index 0000000000..fd9cf0804d
--- /dev/null
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/java/org/apache/tika/pipes/core/DocsExampleConfigsTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.pipes.core;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Doc examples are symlinks to test configs; a test-only component in one
fails at startup for
+ * users who copy it (TIKA-4984).
+ */
+public class DocsExampleConfigsTest {
+
+ private static final String EXAMPLES_RELATIVE_PATH =
"docs/modules/ROOT/examples";
+
+ private static final Pattern MOCK_COMPONENT =
Pattern.compile("\"(mock-[a-z0-9-]+)\"\\s*:");
+
+ @Test
+ public void testNoMockComponentsInDocExamples() throws Exception {
+ List<String> offenders = new ArrayList<>();
+ try (Stream<Path> files = Files.list(findExamplesDir())) {
+ for (Path p : (Iterable<Path>) files.filter(f ->
f.toString().endsWith(".json"))::iterator) {
+ Matcher m = MOCK_COMPONENT.matcher(Files.readString(p,
StandardCharsets.UTF_8));
+ while (m.find()) {
+ offenders.add(p.getFileName() + ": " + m.group(1));
+ }
+ }
+ }
+ assertTrue(offenders.isEmpty(), "test-only components in doc examples:
" + offenders);
+ }
+
+ private static Path findExamplesDir() {
+ Path dir = Path.of("").toAbsolutePath();
+ for (int i = 0; i < 6 && dir != null; i++, dir = dir.getParent()) {
+ Path candidate = dir.resolve(EXAMPLES_RELATIVE_PATH);
+ if (Files.isDirectory(candidate)) {
+ return candidate;
+ }
+ }
+ throw new IllegalStateException(
+ "could not locate " + EXAMPLES_RELATIVE_PATH + " above " +
Path.of("").toAbsolutePath());
+ }
+}
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
index 4696e1d0f6..900f1b883c 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-basic.json
@@ -46,7 +46,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"timeout-limits": {
"progressTimeoutMillis": 5000
}
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
index fbbaa4c906..326f88f309 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-exception-reporting.json
@@ -46,7 +46,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"exception-reporting": {
"level": "MESSAGE_REDACTED",
"maxLength": 10000
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
index 95fabb581c..f75f7df84c 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-inference-bindings.json
@@ -51,7 +51,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"timeout-limits": {
"progressTimeoutMillis": 5000
}
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
index 41847b4ee4..6129347a14 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-passback.json
@@ -45,7 +45,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"timeout-limits": {
"progressTimeoutMillis": 60000
}
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
index 320133e6c9..211ee58f23 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-shared-server.json
@@ -47,7 +47,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"timeout-limits": {
"progressTimeoutMillis": 5000
}
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
index fc1a796a34..afa53cb69a 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-text-recognizers.json
@@ -47,7 +47,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"timeout-limits": {
"progressTimeoutMillis": 5000
}
diff --git
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
index fec18edc38..2171cbe7d8 100644
---
a/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
+++
b/tika-pipes/tika-pipes-integration-tests/src/test/resources/configs/tika-config-uppercasing.json
@@ -42,7 +42,9 @@
"throwOnZeroBytes": false
},
"parse-context": {
- "mock-digester-factory": {},
+ "commons-digester-factory": {
+ "digests": [{ "algorithm": "SHA256" }]
+ },
"timeout-limits": {
"progressTimeoutMillis": 60000
}