This is an automated email from the ASF dual-hosted git repository.

tballison pushed a commit to branch branch_3x
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/branch_3x by this push:
     new 14436943c8 TIKA-4698: Fix CompositeExternalParser failing to load in 
standalone OSGi bundle (#2842)
14436943c8 is described below

commit 14436943c81738b0247f065efe16885694e0cd81
Author: basix86 <[email protected]>
AuthorDate: Thu May 28 21:53:19 2026 +0200

    TIKA-4698: Fix CompositeExternalParser failing to load in standalone OSGi 
bundle (#2842)
    
    * TIKA-4698 -- add explicit org.apache.tika.parser.external to 
Import-Package
    
    bnd only scans bytecode to auto-detect Import-Package entries.
    CompositeExternalParser (in tika-core) is registered only via the
    META-INF/services SPI file in tika-parsers-standard-package and is not
    referenced in compiled bytecode, so its package 
org.apache.tika.parser.external
    was silently omitted from the generated MANIFEST.MF.
    
    In a standalone OSGi deployment (tika-core and tika-parsers-standard-package
    as separate bundles) the bundle classloader then cannot wire to the
    org.apache.tika.parser.external package exported by tika-core, so the
    SPI-loaded CompositeExternalParser fails to resolve.
    
    Fix: list org.apache.tika.parser.external explicitly in Import-Package.
    
    * TIKA-4698 -- explain why org.apache.tika.parser.external must be explicit
    
    bnd only scans bytecode for auto-detected Import-Package entries; a wildcard
    like org.apache.tika.* does not generate an import for packages referenced
    only in SPI files. Without this comment a future contributor may remove the
    line thinking it is redundant with the wildcard below it.
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
 .../tika-parsers-standard/tika-parsers-standard-package/pom.xml       | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/pom.xml 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/pom.xml
index ec2b17d8aa..17d7d2a0ed 100644
--- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/pom.xml
+++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/pom.xml
@@ -353,6 +353,10 @@
             </Bundle-Activator>
             <Import-Package>
               org.w3c.dom,
+              <!-- SPI-only reference (class in tika-core, no bytecode in this 
bundle):
+                   bnd only scans bytecode for auto-detected imports, so this 
package
+                   is silently omitted by the wildcard below and must be 
listed explicitly. -->
+              org.apache.tika.parser.external,
               org.apache.tika.*,
               *;resolution:=optional
             </Import-Package>

Reply via email to