tballison commented on a change in pull request #446:
URL: https://github.com/apache/tika/pull/446#discussion_r663133878



##########
File path: tika-core/src/main/java/org/apache/tika/config/TikaActivator.java
##########
@@ -51,14 +53,17 @@ public void start(final BundleContext context) throws 
Exception {
 
         detectorTracker = new ServiceTracker(context, 
Detector.class.getName(), this);
         parserTracker = new ServiceTracker(context, Parser.class.getName(), 
this);
+        zipDetectorTracker = new ServiceTracker(context, 
"org.apache.tika.detect.zip.ZipContainerDetector", this);

Review comment:
       Do we need to do this for EncodingDetector as well to ensure that all 
encoding detectors are dynamically loaded?  Obv, separate pull request...but 
I'm curious if that is failing in OSGi.

##########
File path: 
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-zip-commons/src/main/java/org/apache/tika/detect/zip/DefaultZipContainerDetector.java
##########
@@ -262,12 +266,21 @@ private MediaType detect(ZipArchiveEntry zae, 
ZipArchiveInputStream zis,
     }
 
     private MediaType finalDetect(StreamingDetectContext detectContext) {
-        for (ZipContainerDetector d : zipDetectors) {
+        for (ZipContainerDetector d : getDetectors()) {
             MediaType mt = d.streamingDetectFinal(detectContext);
             if (mt != null) {
                 return mt;
             }
         }
         return MediaType.APPLICATION_ZIP;
     }
+    
+    private List<ZipContainerDetector> getDetectors() {
+        if (loader != null) {
+            List<ZipContainerDetector> zipDetectors = new 
ArrayList<>(staticZipDetectors);

Review comment:
       In DefaultDetector, the order is dynamic detectors and then we add the 
statically loaded detectors with `super.getDetectors()`.  Here the order is 
reversed.  Why the difference, will it make any difference?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to