Am 16.02.12 17:22, schrieb Nick Burch:
On Thu, 16 Feb 2012, Stephan Mühlstrasser wrote:

That's not a unit test though - yours needs to be run manually. If we
can run it automatically, we can add it to the test suite to make sure
it doesn't get broken in future.

I understand, here is the reproduction as a unit test:

package org.apache.tika;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

import junit.framework.TestCase;

import org.junit.Before;

/**
 * Provoke endless recursion with small configuration file that loads the
* default parser, but omits mimetypes and detector. If this is an insuffient * configuration file, Tika should report an error. Instead it terminates with
 * an OutOfMemoryError.
 *
 * @author [email protected]
 */
public class ConfigFile extends TestCase {

    File configFile;

    @Before
    public void setUp() throws Exception {
        configFile = File.createTempFile("tika-config", ".xml");
        configFile.deleteOnExit();
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(configFile), "UTF-8"); osw.write("<properties><parsers><parser class=\"org.apache.tika.parser.DefaultParser\"/></parsers></properties>\n");
        osw.close();
    }

    public void test() throws IOException {
        System.setProperty("tika.config", configFile.getAbsolutePath());

        new Tika();
    }
}

Best Regards
Stephan

--
_______________________________________________________________
Stephan Mühlstrasser   [email protected]            www.pdflib.com
  PDFlib GmbH, Franziska-Bilek-Weg 9, 80339 München,  Germany
       Court of registry/Amtsgericht München HRB 129497
 Managing Directors/Geschäftsführer: Thomas Merz, Petra Porst
---------------------------------------------------------------
    PDFlib: powerful toolkits for PDF developers since 1997
_______ See www.pdflib.com/products for product details________

Reply via email to