Claude Warren created RAT-593:
---------------------------------

             Summary: short circuit TikiaProcessor DocumentType detection.
                 Key: RAT-593
                 URL: https://issues.apache.org/jira/browse/RAT-593
             Project: Apache RAT
          Issue Type: Improvement
          Components: core engine
    Affects Versions: 0.19
            Reporter: Claude Warren


After looking at the reorganization of the Document types. I think we can do 
better. In addition to the changes here we can add checks in 
{{{}TikaProcessor.fromMediaType(){}}}. Currently there is a test for the media 
type being {{Text}} but I think we can add some checks for the media subtype. 
from the list presented here it looks like if the subtype ends with
 * {{+xml}} it is a standard document
 * {{{}-zip{}}}, {{{}-bzip2{}}}, {{{}-gzip{}}}, {{-compressed}} (and perhaps a 
few others) it is an archive
 * {{+zip}} is also an archive.

this change will require that we modifiy the TikaProcessorTest to detect that 
these extensions are not in the map.

I think the way to do this is to modify the {{fromMediaType()}} method to 
return an Optional<Document.Type> and then modify the call in 
{{TikaProcessor.process}} to return the optional value or BINARY if there is no 
value. (exactly what we do now). The test can then verify that a proper value 
is returned and if non can still list that they are missing from the test/map.

 

The advantage is that we pick up any subtypes that list themselves as XML, zip, 
bzip2, gzip, or compressed without having to add them to the map.  This reduces 
the size of the map and reduces our maintenance load.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to