[ 
https://issues.apache.org/jira/browse/TIKA-4859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109613#comment-18109613
 ] 

ASF GitHub Bot commented on TIKA-4859:
--------------------------------------

Copilot commented on code in PR #3097:
URL: https://github.com/apache/tika/pull/3097#discussion_r3888895079


##########
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:
   The comment claims that "documented examples" use both "no_ocr" and 
"NO_OCR", but the docs in this PR only show "NO_OCR" (and there are no 
remaining "no_ocr" occurrences under docs/). Update the comment to avoid 
stating something that is no longer true.



##########
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:
   This release note says the documented "no_ocr" works, but this PR updates 
the docs to only show "NO_OCR" (there are no remaining "no_ocr" examples under 
docs/). Reword the entry to describe the behavior (case-insensitive matching) 
without relying on a specific docs string.





>  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)

Reply via email to