You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Ryan McKinley (JIRA)" <ji...@apache.org> on 2012/10/30 07:08:12 UTC

[jira] [Updated] (TIKA-1014) Support custom error handling in MimeTypesReader

     [ https://issues.apache.org/jira/browse/TIKA-1014?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley updated TIKA-1014:
--------------------------------

    Attachment: TIKA-1014-CustomErrorHandling.patch

Here is a *rough* patch that adds an error handling class and some hooks to wire it up.

The default class is:
{code:java}

public class MimeTypesReaderErrorHandler {

  public void onMimeTypeError(String name, MimeTypes types, MimeTypeException e) throws SAXException {
    throw new SAXException(e);
  }
  
  public void onGlobError(MimeType type, String pattern, boolean isRegex, MimeTypes types, MimeTypeException ex) throws SAXException {
    throw new SAXException(ex);
  }
}
{code}

This adds a function to MimeTypesFactory:
{code:java}
public static MimeTypes create(Iterable<InputStream> inputStreams, MimeTypesReaderErrorHandler errors)
            throws IOException, MimeTypeException {
{code}

I don't really like the name, but I am posting this here to see what people think and any suggestions on how to support lenient parsing.

thanks
ryan



                
> Support custom error handling in MimeTypesReader
> ------------------------------------------------
>
>                 Key: TIKA-1014
>                 URL: https://issues.apache.org/jira/browse/TIKA-1014
>             Project: Tika
>          Issue Type: New Feature
>          Components: mime
>            Reporter: Ryan McKinley
>            Priority: Minor
>         Attachments: TIKA-1014-CustomErrorHandling.patch
>
>
> Currently if you try to register multiple mimetypes to the same extension, the parser dies with a SAXException.
> It would be great if the error behavior was customizable so that we could optionally continue and log (or whatever) errors

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira