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

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

tballison commented on PR #3260:
URL: https://github.com/apache/tika/pull/3260#issuecomment-5878104962

   From my :robot: 
   ```
   Thanks, the direction looks right, and the new BundleIT checks are great. A 
few things before merge:
   
   1. **Make the imports of the un-embedded bundles mandatory.** They currently 
come in through `*;resolution:=optional`, so an OSGi deployment that misses one 
of the new bundles still resolves and then fails with `NoClassDefFoundError` 
mid-parse. With explicit, non-optional imports, Felix refuses to resolve and 
names the missing package.
   
   2. **Floor the versions at what Tika builds with.** bnd's defaults allow 
older patch releases than we test (`org.apache.pdfbox` `[3.0,4)`, 
`org.apache.commons.compress` `[1.28,2)`), and `org.apache.commons.io` comes 
out as `[1.4,2)` (from mime4j's import). That range is only satisfied by 
commons-io 2.22 through its `1.4.9999` compat export, and a real 1.4 bundle 
would satisfy it too.
   
   The attached patch does both, using the parent-pom version properties so 
dependabot bumps carry through. BouncyCastle stays literal because its packages 
export major.minor only. `com.adobe.internal.xmp.impl` and 
`org.apache.pdfbox.debugger` stay optional since no deployed bundle exports 
them. With it, BundleIT passes, and removing `commons-compress.jar` from 
`target/test-bundles` makes the bundle fail resolution with `missing 
requirement ... osgi.wiring.package`.
   
   3. **CHANGES:** main now has a 4.2.0 section; please add an entry listing 
the bundles OSGi users must now install.
   
   4. **PDF test:** the `DefaultParser` recursion you found is fixed in 
TIKA-4942 (the detector recursed the same way). Once that's merged, could 
`testPdfParsing` go through the registered `Parser` service instead of 
`PDFParser` directly?
   
   Minor: the description says commons-io 2.x doesn't satisfy mime4j's 
`[1.4,2)`. It does, via the compat export mentioned above. Keeping mime4j 
embedded is fine either way.
   ```




> tika-bundle-standard: do not embed dependencies that are OSGi bundles
> ---------------------------------------------------------------------
>
>                 Key: TIKA-4934
>                 URL: https://issues.apache.org/jira/browse/TIKA-4934
>             Project: Tika
>          Issue Type: Improvement
>            Reporter: Piotr Karwasz
>            Priority: Minor
>
> The {{tika-bundle-standard}} OSGi bundle is described as containing "the 
> tika-parsers-standard component and all its upstream dependencies that aren't 
> OSGi bundles by themselves," but its {{Embed-Dependency}} list also embeds 
> many dependencies that ship proper OSGi manifests. As a result:
> * these libraries are duplicated inside the bundle instead of being shared 
> with other bundles in the container, and they can't be updated independently;
> * {{commons-io}} is both embedded and installed as a separate bundle;
> * {{pdfbox-io}} is not embedded at all, although {{pdfbox}} and {{fontbox}} 
> require {{org.apache.pdfbox.io}}. Since every import of 
> {{tika-bundle-standard}} is optional, the bundle resolves anyway and PDF 
> parsing fails at runtime with {{NoClassDefFoundError}}.
> h3. Proposed change
> Stop embedding the following dependencies; they must be deployed as separate 
> bundles alongside {{tika-core}} and {{tika-bundle-standard}}:
> * {{commons-io:commons-io}}
> * {{commons-codec:commons-codec}}
> * {{commons-logging:commons-logging}} (1.4+, required by pdfbox; 
> {{jcl-over-slf4j}} only exports version 1.2)
> * {{org.apache.commons:commons-collections4}}
> * {{org.apache.commons:commons-compress}}
> * {{org.apache.commons:commons-csv}}
> * {{org.apache.commons:commons-exec}}
> * {{org.apache.commons:commons-lang3}}
> * {{org.apache.commons:commons-math3}}
> * {{org.apache.pdfbox:pdfbox}}
> * {{org.apache.pdfbox:pdfbox-io}}
> * {{org.apache.pdfbox:fontbox}}
> * {{org.bouncycastle:bcprov-jdk18on}}, {{bcpkix-jdk18on}}, 
> {{bcutil-jdk18on}}, {{bcjmail-jdk18on}}
> * {{org.jsoup:jsoup}}
> * {{org.ow2.asm:asm}}
> * {{org.tukaani:xz}}
> * {{com.adobe.xmp:xmpcore}}
> * {{com.googlecode.plist:dd-plist}}
> The following are OSGi bundles but stay embedded because they cannot be 
> resolved as standalone bundles:
> * {{apache-mime4j-core}} / {{apache-mime4j-dom}}: import 
> {{org.apache.commons.io;version="[1.4,2)"}}, which commons-io 2.x does not 
> satisfy;
> * {{rome}}: requires {{org.jdom2}}, which is not an OSGi bundle;
> * {{jackcess}} / {{jackcess-encrypt}} (fragment): {{jackcess}} uses 
> {{org.apache.poi.poifs.filesystem}} for OLE attachments, and POI is only 
> available inside {{tika-bundle-standard}}.
> h3. Tests
> {{BundleIT}} now installs every jar in {{target/test-bundles}} (populated by 
> {{test-bundles.xml}}), asserts that all bundles are active, and checks that 
> classes from each external dependency can be loaded through 
> {{tika-bundle-standard}}, since optional imports would otherwise hide a 
> missing bundle.
> h3. Compatibility
> OSGi users of {{tika-bundle-standard}} must deploy the bundles listed above. 
> The list should be mentioned in {{CHANGES.txt}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to