[
https://issues.apache.org/jira/browse/TIKA-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109638#comment-18109638
]
ASF GitHub Bot commented on TIKA-4859:
--------------------------------------
dschmidt commented on code in PR #3097:
URL: https://github.com/apache/tika/pull/3097#discussion_r3889156527
##########
tika-serialization/src/main/java/org/apache/tika/config/loader/TikaObjectMapperFactory.java:
##########
@@ -126,6 +127,10 @@ public static ObjectMapper createMapper(JsonFactory
factory) {
// Ensure enums are properly validated (not just numeric values)
mapper.configure(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS,
true);
+ // Accept enum values in any case ("no_ocr" as well as "NO_OCR"), the
+ // documented examples and hand-written requests use both
+ mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true);
Review Comment:
Reworded.
##########
CHANGES.txt:
##########
@@ -1,5 +1,8 @@
Release 4.1.0 - unreleased
+ * Enum values in JSON configuration are matched case-insensitively, so the
+ documented "no_ocr" works as well as "NO_OCR" (TIKA-4859).
Review Comment:
Reworded.
> Enum values in JSON config are case-sensitive; the server docs use no_ocr
> --------------------------------------------------------------------------
>
> Key: TIKA-4859
> URL: https://issues.apache.org/jira/browse/TIKA-4859
> Project: Tika
> Issue Type: Bug
> Reporter: Dominik Schmidt
> Priority: Minor
> Fix For: 4.1.0
>
>
> {"pdf-parser": {"ocr": {"strategy": "no_ocr"}}} is the example in
> using-tika/server/index.adoc, but OcrConfig.Strategy is deserialized by
> Enum.valueOf, so the request answers 422; NO_OCR works. Other enums in the
> config (imageStrategy, suffixStrategy, ...) behave the same. Either make enum
> deserialization case-insensitive (the UnpackConfig enums already ship a
> parse(String) that upper-cases) or fix the documentation examples.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)