Skip to content

Commit 5c451d7

Browse files
committed
TIKA-4834 follow-ons
1 parent ca633f9 commit 5c451d7

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Release 4.1.0 - unreleased
44
// or /* */ comments, as the configuration docs have always said they
55
may. The main loader accepted them; the steps that re-read the user's
66
file to merge in server/CLI overrides (ConfigMerger, ensurePluginRoots)
7-
used a strict parser and refused the whole file (TIKA-4834).
7+
used their own bare parser and refused the whole file; they now use the
8+
shared TikaObjectMapperFactory mapper (TIKA-4834).
89

910
* The Kafka pipes iterator no longer stops at the first empty poll. A newly
1011
subscribed consumer spends its first poll(s) joining the group and returns

tika-pipes/tika-async-cli/src/main/java/org/apache/tika/async/cli/TikaAsyncCLI.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.Optional;
2626
import java.util.concurrent.TimeoutException;
2727

28-
import com.fasterxml.jackson.core.JsonParser;
2928
import com.fasterxml.jackson.databind.JsonNode;
3029
import com.fasterxml.jackson.databind.ObjectMapper;
3130
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -39,6 +38,7 @@
3938

4039
import org.apache.tika.config.EmbeddedLimits;
4140
import org.apache.tika.config.loader.TikaJsonConfig;
41+
import org.apache.tika.config.loader.TikaObjectMapperFactory;
4242
import org.apache.tika.exception.TikaConfigException;
4343
import org.apache.tika.parser.ParseContext;
4444
import org.apache.tika.pipes.api.FetchEmitTuple;
@@ -445,9 +445,8 @@ static String resolveDefaultPluginsDir() {
445445
* @return the config path to use (original if plugin-roots exists, or a new merged config)
446446
*/
447447
static Path ensurePluginRoots(Path originalConfigPath, String pluginsDir) throws IOException {
448-
ObjectMapper mapper = new ObjectMapper();
449-
// The user's file may carry the // and /* */ comments the config docs permit.
450-
mapper.enable(JsonParser.Feature.ALLOW_COMMENTS);
448+
// The shared config mapper: same comment and strictness rules as the main loader.
449+
ObjectMapper mapper = TikaObjectMapperFactory.getMapper();
451450
JsonNode rootNode = mapper.readTree(originalConfigPath.toFile());
452451

453452
if (rootNode.has("plugin-roots")) {

tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/config/ConfigMerger.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525
import java.util.Map;
2626
import java.util.UUID;
2727

28-
import com.fasterxml.jackson.core.JsonParser;
2928
import com.fasterxml.jackson.databind.JsonNode;
3029
import com.fasterxml.jackson.databind.ObjectMapper;
31-
import com.fasterxml.jackson.databind.SerializationFeature;
3230
import com.fasterxml.jackson.databind.node.ArrayNode;
3331
import com.fasterxml.jackson.databind.node.ObjectNode;
3432
import org.slf4j.Logger;
3533
import org.slf4j.LoggerFactory;
3634

3735
import org.apache.tika.config.TimeoutLimits;
36+
import org.apache.tika.config.loader.TikaObjectMapperFactory;
3837
import org.apache.tika.pipes.api.ComponentIds;
3938

4039
/**
@@ -91,10 +90,8 @@ private ConfigMerger() {
9190
*/
9291
public static MergeResult mergeOrCreate(Path existingConfig, ConfigOverrides overrides)
9392
throws IOException {
94-
ObjectMapper mapper = new ObjectMapper();
95-
mapper.enable(SerializationFeature.INDENT_OUTPUT);
96-
// The user's file may carry the // and /* */ comments the config docs permit.
97-
mapper.enable(JsonParser.Feature.ALLOW_COMMENTS);
93+
// The shared config mapper: same comment and strictness rules as the main loader.
94+
ObjectMapper mapper = TikaObjectMapperFactory.getMapper();
9895

9996
ObjectNode root;
10097
if (existingConfig != null && Files.exists(existingConfig)) {

0 commit comments

Comments
 (0)