Skip to content

Fix Tika 4 parser package dependency and MIME regressions - #22

Merged
loong10k merged 4 commits into
mainfrom
fix/tika-4-pom-packaging
Nov 17, 2026
Merged

loong10k merged 4 commits into
mainfrom
fix/tika-4-pom-packaging

Conversation

@loong10k

@loong10k loong10k commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

  • Upgrade Tika Core and the standard parser package to 4.0.0; declare the parser package as a POM in dependency management and the provided dependency.
  • Add MIME regressions for PDF, misleading extensions, a JAR with its manifest beyond 64 KiB, and DOCX/XLSX structures with media entries before content types.
  • Preserve caller-owned ByteArrayInputStream position while detecting the full container. Other markable streams are fully detected and reset up to 1 MiB; larger ones fail with checked IOException rather than returning a MIME type from a truncated prefix. Non-markable streams remain supported but may advance, and are not closed.
  • Restore JaCoCo agent arguments in Surefire, and correct English and Chinese documentation for Tika 4 packaging, provided scope, and custom parser/detector SPI migration.

Validation

  • JDK 17: mvn -B --no-transfer-progress clean verify — 121 tests passed locally.
  • mvn dependency:tree -Dincludes=org.apache.tika confirms Core JAR 4.0.0 and parser POM 4.0.0 (provided).
  • Local JaCoCo line coverage: 737/892 (82.62%), below the configured 90% target. The existing haltOnFailure=false makes this a warning.

Remaining compatibility limit

A generic markable stream larger than 1 MiB cannot simultaneously guarantee full container detection, bounded memory, and restoration of its original position. This API now fails explicitly for that case. The File and UploadFile overloads support larger inputs without this limit. Review this tradeoff before merging.

Supersedes Dependabot PR #19, whose version-only update expects a parser JAR.

Copy link
Copy Markdown
Collaborator Author

Superseded by named feature branch PR #24 and test-to-main PR #25. The replacement removes the draft's arbitrary 1 MiB failure for markable streams, adds large PDF/JAR regressions, and passed JDK 17 local and exact-candidate GitHub CI. Main merged at b988add. The unchanged JaCoCo 90% advisory target remains below threshold and is disclosed in the replacement PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant