Skip to content

Commit d9968db

Browse files
authored
TIKA-4808: pre 4.0.0 release fixes (#3032)
1 parent c45f648 commit d9968db

322 files changed

Lines changed: 11653 additions & 11161 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/check_split_packages.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,47 @@
2323
Scope: main sources only (src/main/java) -- that is what JPMS cares about;
2424
test sources live in the unnamed module and are intentionally excluded.
2525
26+
Generated code counts too: protoc output ships in the module's jar, so a .proto
27+
whose `option java_package` names another module's package is a split package
28+
even though no such directory exists in src/main/java. Those classes land under
29+
target/, which is pruned here and would need a build to see, so the proto option
30+
is read straight from src/main/proto instead (TIKA-4808).
31+
2632
Usage: python3 .github/scripts/check_split_packages.py [repo_root]
2733
Exit: 0 = no split packages, 1 = split package(s) found.
2834
"""
2935
import os
36+
import re
3037
import sys
3138
import collections
3239

3340
PRUNE = {"target", ".git", ".local_m2_repo", "node_modules", ".mvn"}
3441

42+
JAVA_PACKAGE_OPTION = re.compile(
43+
r'^\s*option\s+java_package\s*=\s*"([^"]+)"\s*;', re.M)
44+
3545

3646
def main() -> int:
3747
root = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else ".")
3848
pkg_to_modules = collections.defaultdict(set)
39-
for dirpath, dirnames, _ in os.walk(root):
49+
for dirpath, dirnames, files in os.walk(root):
4050
dirnames[:] = [d for d in dirnames if d not in PRUNE]
4151
norm = dirpath.replace(os.sep, "/")
52+
53+
if norm.endswith("/src/main/proto") or "/src/main/proto/" in norm + "/":
54+
marker = os.sep + os.path.join("src", "main", "proto")
55+
idx = dirpath.find(marker)
56+
if idx > 0:
57+
module = os.path.relpath(dirpath[:idx], root).replace(os.sep, "/")
58+
for f in files:
59+
if not f.endswith(".proto"):
60+
continue
61+
with open(os.path.join(dirpath, f), encoding="utf-8") as fh:
62+
m = JAVA_PACKAGE_OPTION.search(fh.read())
63+
if m:
64+
pkg_to_modules[m.group(1)].add(module)
65+
continue
66+
4267
if not norm.endswith("/src/main/java"):
4368
continue
4469
src_root = dirpath

CHANGES.txt

Lines changed: 231 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ Release 4.0.0 - ???
22

33
BREAKING CHANGES
44

5+
* tika-app: the inline short forms -eX (output encoding), -pX (document
6+
password) and -c<uri> (network client) were removed from standard mode.
7+
Use --encoding=X, --password=X and --client=<uri>. These were the only
8+
short flags that consumed an inline value, and matching them by prefix
9+
meant a long name written with one dash was silently swallowed:
10+
-config=tika.json set the network-client URI to "onfig=tika.json" and
11+
loaded no config file, with no error. Every single-dash long name is now
12+
rejected with a message naming the two-dash form (TIKA-4808).
13+
514
* Metadata's reserved tk: (and legacy X-TIKA:) namespace is now a trust
615
boundary for String-keyed writes. A String write to a reserved key throws
716
IllegalArgumentException instead of 3.x's silent success or silent drop,
@@ -89,6 +98,41 @@ Release 4.0.0 - ???
8998
staleFetcherDelaySeconds have been removed; a config still carrying them
9099
fails startup (TIKA-4809).
91100

101+
* An unregistered component name in a default-parser, default-detector or
102+
default-encoding-detector "exclude" list now throws a TikaConfigException
103+
at config load instead of logging a WARN. Silently ignoring an exclusion
104+
left a deliberately disabled component enabled. A config that loaded with
105+
a warning on 3.x -- typically one that names the excluded component by
106+
class name, or misspells it -- now refuses to start. Use the registered
107+
component name (e.g. "pdf-parser"); tika-app --list-parser-names prints
108+
them (TIKA-3268, TIKA-4808).
109+
110+
* ParseContext configuration is now resolved per component instance rather
111+
than per config class. ConfigDeserializer no longer publishes a resolved
112+
config under its class, because a class-keyed write leaked one component's
113+
config to every other component sharing that config class -- the three VLM
114+
parsers all bind VLMOCRConfig, so one provider's base URL and API key
115+
reached the other two. Two user-visible consequences:
116+
parseContext.get(SomeConfig.class) no longer returns a JSON-resolved
117+
config, so a third-party component following the PDFBoxRenderer pattern
118+
must now be handed its config explicitly; and precedence is inverted --
119+
a JSON config for a key now beats a programmatic
120+
context.set(XConfig.class, ...), where the programmatic value used to win.
121+
The programmatic value is still honored for a key with no JSON config.
122+
Resolved configs are cached by (component name, config class), so a
123+
component that resolves a validation-only RuntimeConfig and then
124+
re-resolves its real config class gets each as its own instance and still
125+
merges the operator's defaults (TIKA-4808).
126+
127+
* tika-grpc: the generated Java classes moved from package org.apache.tika
128+
to org.apache.tika.pipes.grpc.proto (java_package in tika.proto;
129+
java_multiple_files stays true), so every generated type moves --
130+
TikaGrpc, FetchAndParseRequest, FetchAndParseReply and the rest. Java gRPC
131+
clients must update their imports. This is a source break only: the proto
132+
package ("tika") and the service name ("Tika") are unchanged, so the wire
133+
protocol is identical and clients in other languages, or Java clients that
134+
are not recompiled, are unaffected (TIKA-4808).
135+
92136
* ExceptionUtils.trimMessage has been removed from tika-core; it moved into
93137
tika-eval-core (TIKA-4809).
94138

@@ -115,19 +159,203 @@ Release 4.0.0 - ???
115159

116160
* tika-server: the tika-server-client module has been removed (TIKA-4809).
117161

162+
* Tika 4.x requires Java 17 or later; 3.x built and ran on Java 11. All
163+
published artifacts are compiled with --release 17 (TIKA-4685).
164+
165+
* The core SPI signatures changed. Parser.parse now takes a TikaInputStream
166+
instead of an InputStream (there is no InputStream overload),
167+
Detector.detect takes (TikaInputStream, Metadata, ParseContext) instead of
168+
(InputStream, Metadata), and EmbeddedDocumentExtractor's
169+
shouldParseEmbedded/parseEmbedded gained a ParseContext and take a
170+
TikaInputStream. Every third-party Parser, Detector or
171+
EmbeddedDocumentExtractor implementation must be updated; callers can wrap
172+
with TikaInputStream.get(...). The Tika facade (Tika.parse/parseToString)
173+
still accepts an InputStream and is unaffected. Tika.detect(InputStream, ...)
174+
no longer resets the stream to its original position: detection now reads
175+
ahead through a TikaInputStream, so on return the caller's stream must be
176+
treated as consumed. It still does not close the caller's stream, and any
177+
temporary file spooled during detection is deleted before it returns
178+
(TIKA-4399, TIKA-4541, TIKA-4569).
179+
180+
* TikaConfig and the org.apache.tika.config XML-configuration API are
181+
removed: TikaConfig, ConfigBase, Field, Param, ParamField,
182+
LoadErrorHandler, InitializableProblemHandler, TikaConfigSerializer and
183+
TikaTaskTimeout are gone. Use TikaLoader from tika-serialization; see
184+
migrating-to-4x.adoc (TIKA-4545, TIKA-4553, TIKA-4565).
185+
186+
* ForkParser and the entire org.apache.tika.fork package are removed from
187+
tika-core. Out-of-process parsing is now provided by PipesForkParser in
188+
the new tika-pipes-fork-parser module. tika-app's -f/--fork routes through
189+
it, and --fork-timeout is rejected rather than silently ignored
190+
(TIKA-4554, TIKA-4571, TIKA-4651).
191+
192+
* tika-app and tika-server-standard now ship as zip distributions with an
193+
adjacent lib/ directory; the published jars are thin launchers and fail
194+
with NoClassDefFoundError if run on their own (TIKA-4733).
195+
196+
* The encoding detectors moved out of parser packages into
197+
org.apache.tika.detect.* and into new tika-encoding-detector-* modules:
198+
org.apache.tika.parser.txt.{CharsetDetector,CharsetMatch,
199+
Icu4jEncodingDetector,UniversalEncodingDetector,BOMDetector,...} are now
200+
org.apache.tika.detect.icu4j.*, org.apache.tika.detect.universal.* and
201+
org.apache.tika.detect.BOMDetector, and
202+
org.apache.tika.parser.html.HtmlEncodingDetector is now
203+
org.apache.tika.detect.html.HtmlEncodingDetector.
204+
NonDetectingEncodingDetector is removed (TIKA-4685, TIKA-4720).
205+
206+
* The tika-langdetect-tika module is removed (TikaLanguageDetector,
207+
LanguageIdentifier, LanguageProfile, LanguageProfilerBuilder,
208+
ProfilingWriter). tika-app, tika-server and tika-eval now bundle the new
209+
CharSoup detector (tika-langdetect-charsoup) instead of
210+
tika-langdetect-optimaize, so the language reported by default changes
211+
(TIKA-4662).
212+
213+
* SolrJ moves from 8.11.4 to 10.0.0; the Solr fetcher, emitter and pipes
214+
iterator no longer support Solr 8 (TIKA-4789).
215+
216+
* tika-app's batch mode is gone. The -bc/batch directory-to-directory command
217+
line (backed by the removed tika-batch module) has no successor flag; use
218+
-a/--async, which runs the same work through tika-pipes (TIKA-4340).
219+
220+
* Metadata's serialVersionUID changed. A Metadata instance serialized by 3.x
221+
now fails deserialization with InvalidClassException instead of silently
222+
producing an object with a null write limiter that throws on first write
223+
(TIKA-4816).
224+
225+
* PDF: extractIncrementalUpdateInfo now defaults to true (was false), so
226+
every PDF parse emits pdf:incremental-update-count and related keys
227+
without configuration. parseIncrementalUpdates remains false
228+
(TIKA-4354, TIKA-4358).
229+
230+
* The DOM-based OOXML extractors are removed (XWPFWordExtractorDecorator,
231+
XSLFPowerPointExtractorDecorator, POIXMLTextExtractorDecorator,
232+
XPSTextExtractor) and with them the OfficeParserConfig keys
233+
useSAXDocxExtractor and useSAXPptxExtractor. The SAX extractors are the
234+
only implementation (TIKA-4692, TIKA-4708).
235+
236+
* The MuPDF renderer is removed (org.apache.tika.renderer.pdf.mutool); PDF
237+
page rendering for OCR now uses the PDFBox renderer or the new
238+
PopplerRenderer (TIKA-4664).
239+
240+
* Parsers and detectors no longer expose bean setters/getters for their
241+
settings. Configuration moves to per-component *Config objects supplied
242+
through the ParseContext (e.g. GeoParserConfig, DWGParserConfig,
243+
AmazonTranscribeConfig, MagikaDetector/SiegfriedDetector configs)
244+
(TIKA-4758).
245+
246+
* TikaInputStream no longer caches by default. A stream is consumed in
247+
passthrough mode unless enableRewind() is called at position 0;
248+
rewind()/getFile()/getPath() after reading without enableRewind() throw
249+
instead of silently spooling. Digesters call enableRewind() themselves
250+
(TIKA-4618, TIKA-4623).
251+
252+
* tika-eval-app's command line changed: the FileProfile sub-command is
253+
removed, the -bc batch-config option is gone, and extract directories are
254+
now named with -e/--extracts (Profile) and -a/--extractsA + -b/--extractsB
255+
(Compare); -i/--inputDir, -d/--db, -c/--config, -n/--numWorkers and
256+
-m/--maxExtractLength replace the 3.x spellings
257+
(TIKA-4342, TIKA-4450, TIKA-4452, TIKA-4507).
258+
259+
* Audio cover art is now extracted as embedded documents from MP3 (ID3v2
260+
APIC/PIC), MP4 (covr), Vorbis and FLAC. Embedded-document counts and
261+
/rmeta list lengths for audio files change (TIKA-4801).
262+
263+
* Additional removals with no direct replacement: the tika-server-eval
264+
module (TIKA-4555); SentimentAnalysisParser (TIKA-4574); the
265+
tika-age-recogniser module / AgeRecogniser (TIKA-4343);
266+
ObjectRecognitionParser and the Tensorflow recognisers/captioners;
267+
PooledTimeSeriesParser; org.apache.tika.parser.pdf.AccessChecker
268+
(replaced by PDFParserConfig.AccessCheckMode);
269+
org.apache.tika.utils.{RereadableInputStream,AnnotationUtils};
270+
org.apache.tika.io.{IOUtils,InputStreamFactory};
271+
org.apache.tika.sax.DIFContentHandler;
272+
org.apache.tika.parser.{AutoDetectParserFactory,ParserFactory};
273+
org.apache.tika.parser.internal.Activator; and the jempbox-based
274+
JempboxExtractor / XMPMetadataExtractor / pdf.xmpschemas.* classes
275+
superseded by the unified XMP extractor (TIKA-4775).
276+
118277
NEW FEATURES
119278

120-
* Content-based detection of ASN.1/DER crypto containers at parse time. An
121-
opt-in Pkcs7Detector surfaces the subtype at detect() time,
122-
but must be enabled via configuration (TIKA-1997).
279+
* Content-based detection of ASN.1/DER crypto containers. Magic for the
280+
PKCS#7/CMS arc ships enabled by default: application/pkcs7-mime gained
281+
magic (3.x had globs only), application/pkcs7-signature's magic was
282+
broadened across the DER length forms, and application/timestamped-data,
283+
application/x-pkcs12, application/x-pkcs7-certificates and
284+
application/x-pkcs7-certreqresp gained magic. Pkcs7Parser further refines
285+
the smime-type on the output Content-Type. Files that detected as
286+
application/octet-stream in 3.x may now detect as a crypto type
287+
(TIKA-1997, TIKA-2856).
288+
289+
* tika-pipes gains three parse modes: NO_PARSE (detect only, no parse),
290+
CONTENT_ONLY (emitters write raw content, no metadata envelope) and
291+
UNPACK (write embedded bytes out). All three are wired through tika-app
292+
and tika-server (TIKA-4631, TIKA-4637, TIKA-4656).
293+
294+
* New tika-pipes plugins: an Elasticsearch emitter (TIKA-4672), an
295+
Atlassian JWT fetcher (TIKA-4604), Google Drive, Microsoft Graph, Azure
296+
Blob, JSON and HTTP plugins, and an Apache Ignite ConfigStore for
297+
runtime fetcher/emitter configuration (TIKA-4583, TIKA-4587, TIKA-4598).
298+
299+
* New inference and OCR modules: tika-inference and tika-vlm add
300+
vision-language-model parsers (Claude, Gemini, OpenAI) that emit
301+
vlm:prompt-tokens / vlm:completion-tokens, and
302+
tika-parser-tess4j-module adds in-process Tesseract OCR
303+
(TIKA-4665, TIKA-4666, TIKA-4667, TIKA-4690).
304+
305+
* A Markdown parser with structured, lossless XHTML output, complementing
306+
the Markdown content handler (TIKA-4770).
307+
308+
* New detection: Android binary XML (application/vnd.android.axml,
309+
TIKA-4747) and Frictionless Data packages (TIKA-4643); improved mp3/aac
310+
(TIKA-4612) and grib (TIKA-4655) detection.
123311

124312
OTHER CHANGES
125313

314+
* Dependency upgrades since 4.0.0-beta-1, including Jetty 12.1.12, CXF
315+
4.2.3 and SolrJ 10.0.0 (TIKA-4327).
316+
317+
* The charset, junk-text and language detection stack was rewritten:
318+
language-aware charset detection, a universal junk detector, wider
319+
Unicode handling and the new CharSoup language detector
320+
(TIKA-4662, TIKA-4671, TIKA-4675, TIKA-4691, TIKA-4719, TIKA-4810).
321+
322+
* New audio/video metadata: audio:bitrate, audio:is-variable-bitrate,
323+
audio:has-drm, audio:channels, video:frame-rate, video:bitrate and MP4
324+
sample size; ID3 TCOP and Vorbis COPYRIGHT map to xmpDM:copyright, EXIF
325+
GPS altitude maps to geo:alt, and the presentation start of delayed
326+
QuickTime timed-metadata tracks is exposed (TIKA-4777, TIKA-4779,
327+
TIKA-4780, TIKA-4781, TIKA-4800, TIKA-4802).
328+
329+
* Parsing and robustness fixes across formats: CHM (TIKA-4783), ID3 UTF-16
330+
(TIKA-4784), MPEG2/2.5 Layer III frame sizing (TIKA-4791), .doc empty
331+
comments (TIKA-4718), OOXML hyphenation and field-code hyperlinks
332+
(TIKA-4646, TIKA-4683), RTF attachments in HTML decapsulation
333+
(TIKA-4710), image extraction (TIKA-4736), embedded-file extension
334+
calculation (TIKA-4808), and general media-file robustness (TIKA-4812).
335+
MAPI properties no longer overwrite better-fitting Dublin Core terms
336+
(TIKA-4806). Embedded-file naming was streamlined (TIKA-4689).
337+
338+
* tika-eval-core is no longer published as a fat jar (TIKA-4414) and
339+
tika-grpc no longer shades gRPC (TIKA-4709).
340+
126341
* PipesClient/PipesServer IPC now enforces a configurable payload limit
127342
(pipes.maxIpcPayloadBytes, default 100 MB) in both directions. Results
128343
that exceed the limit return PAYLOAD_LIMIT_EXCEEDED instead of causing
129344
heap exhaustion; crash messages are also size-capped (TIKA-4793).
130345

346+
* Pipes now carries small documents to the forked worker inside the request
347+
instead of writing them to disk first. A host that already holds the
348+
content -- tika-server's /tika, /rmeta, /meta, /detect and /unpack, or
349+
PipesForkParser with a non-file-backed stream -- sends anything at or
350+
below the new pipes.maxInlineBytes (default 10 MB) in the request, where
351+
the reserved __bytes fetcher serves it in the worker and no disk is
352+
touched; larger content is written out once as before (to tika-server's
353+
input temp directory, or the calling JVM's java.io.tmpdir under
354+
PipesForkParser), and a stream already backed by a file always keeps its
355+
file. Set maxInlineBytes to 0 to spool every non-empty body. The value must
356+
leave room for the rest of the request inside pipes.maxIpcPayloadBytes;
357+
one that does not is rejected at config load (TIKA-4808).
358+
131359
* MagicDetector now compiles its regular expression once, in the
132360
constructor, instead of recompiling it on every match (TIKA-4796).
133361

CONTRIBUTING.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
# Contributing to Apache Tika
2121

22-
Thank you for your interest in contributing to Apache Tika!
23-
24-
For comprehensive contribution guidelines, please see: **https://tika.apache.org/contribute.html**
22+
Full guidelines: <https://tika.apache.org/contribute.html>
2523

2624
## Quick Start
2725

0 commit comments

Comments
 (0)