File tree Expand file tree Collapse file tree
tika-async-cli/src/main/java/org/apache/tika/async/cli
tika-pipes-core/src/main/java/org/apache/tika/pipes/core/config Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 2525import java .util .Optional ;
2626import java .util .concurrent .TimeoutException ;
2727
28- import com .fasterxml .jackson .core .JsonParser ;
2928import com .fasterxml .jackson .databind .JsonNode ;
3029import com .fasterxml .jackson .databind .ObjectMapper ;
3130import com .fasterxml .jackson .databind .node .ObjectNode ;
3938
4039import org .apache .tika .config .EmbeddedLimits ;
4140import org .apache .tika .config .loader .TikaJsonConfig ;
41+ import org .apache .tika .config .loader .TikaObjectMapperFactory ;
4242import org .apache .tika .exception .TikaConfigException ;
4343import org .apache .tika .parser .ParseContext ;
4444import 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" )) {
Original file line number Diff line number Diff line change 2525import java .util .Map ;
2626import java .util .UUID ;
2727
28- import com .fasterxml .jackson .core .JsonParser ;
2928import com .fasterxml .jackson .databind .JsonNode ;
3029import com .fasterxml .jackson .databind .ObjectMapper ;
31- import com .fasterxml .jackson .databind .SerializationFeature ;
3230import com .fasterxml .jackson .databind .node .ArrayNode ;
3331import com .fasterxml .jackson .databind .node .ObjectNode ;
3432import org .slf4j .Logger ;
3533import org .slf4j .LoggerFactory ;
3634
3735import org .apache .tika .config .TimeoutLimits ;
36+ import org .apache .tika .config .loader .TikaObjectMapperFactory ;
3837import 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 )) {
You can’t perform that action at this time.
0 commit comments