On Mon, Aug 24, 2015 at 6:14 PM, Mikhail Titov <mlt-0UDz38MK/[email protected]> wrote: > While writing a reply, I came to a conclusion that in my particular case > I can move all "detection" into a parser code and wrap standard parsers.
Is parser decorator the way to go if I want to dig few more things on top of existing parser output? If so, is there an example anywhere how to write it? I tried following CTAKESParser included with Tika but I'm getting java.lang.StackOverflowError due to endless recursion. I commented out my parser from META-INF/services/org.apache.tika.parser.Parser and I wrapped default parser into my parser in config xml without any other declarations similar to [1]. However, as I mentioned in the beginning, this leads to infinite recursion in default constructor like in [2]. I wonder why Tika doesn't call my parser's constructor that takes another, wrapped parser as an argument according to config xml instead of default constructor (that attempt to read config and so on)? I feel like I'm missing something. P.S. I'm using Tika 1.9 at this moment. Footnotes: [1] https://github.com/apache/tika/blob/trunk/tika-core/src/test/resources/org/apache/tika/config/TIKA-1642-CTakes.xml [2] https://github.com/apache/tika/blob/trunk/tika-parsers/src/main/java/org/apache/tika/parser/ctakes/CTAKESParser.java#L62 -- Mikhail
