This is an automated email from the ASF dual-hosted git repository.
ndipiazza pushed a commit to branch tika-grpc-3x-features
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/tika-grpc-3x-features by this
push:
new 54d264a8b TIKA-4252: duplicate fetcher - don't fail for now.
54d264a8b is described below
commit 54d264a8b296d5fc8cf777a80a20136133a92a3e
Author: Nicholas DiPiazza <[email protected]>
AuthorDate: Thu May 9 21:36:48 2024 -0500
TIKA-4252: duplicate fetcher - don't fail for now.
---
.../java/org/apache/tika/pipes/fetcher/FetcherManager.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git
a/tika-core/src/main/java/org/apache/tika/pipes/fetcher/FetcherManager.java
b/tika-core/src/main/java/org/apache/tika/pipes/fetcher/FetcherManager.java
index 40121f9a7..6a4c921a0 100644
--- a/tika-core/src/main/java/org/apache/tika/pipes/fetcher/FetcherManager.java
+++ b/tika-core/src/main/java/org/apache/tika/pipes/fetcher/FetcherManager.java
@@ -25,6 +25,9 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.tika.config.ConfigBase;
import org.apache.tika.exception.TikaConfigException;
import org.apache.tika.exception.TikaException;
@@ -35,7 +38,7 @@ import org.apache.tika.exception.TikaException;
* This forbids multiple fetchers supporting the same name.
*/
public class FetcherManager extends ConfigBase {
-
+ private static final Logger LOG =
LoggerFactory.getLogger(FetcherManager.class);
public static FetcherManager load(Path p) throws IOException,
TikaConfigException {
try (InputStream is =
Files.newInputStream(p)) {
@@ -48,12 +51,12 @@ public class FetcherManager extends ConfigBase {
public FetcherManager(List<Fetcher> fetchers) throws TikaConfigException {
for (Fetcher fetcher : fetchers) {
String name = fetcher.getName();
- if (name == null || name.trim().length() == 0) {
- throw new TikaConfigException("fetcher name must not be
blank");
+ if (name == null || name.trim().isEmpty()) {
+ throw new TikaConfigException("Fetcher name must not be
blank");
}
if (fetcherMap.containsKey(fetcher.getName())) {
- throw new TikaConfigException(
- "Multiple fetchers cannot support the same prefix: " +
fetcher.getName());
+ LOG.warn("Duplicate fetcher saved in the tika-config xml: {}.
Ignoring.", fetcher.getName());
+ continue;
}
fetcherMap.put(fetcher.getName(), fetcher);
}