You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by Nick Burch <ni...@alfresco.com> on 2011/03/24 00:52:02 UTC
Re: svn commit: r1084798 - in /tika/trunk:
tika-core/src/main/java/org/apache/tika/parser/CompositeParser.java
tika-parsers/src/test/java/org/apache/tika/parser/AutoDetectParserTest.jav
a
On Thu, 24 Mar 2011, Jukka Zitting wrote:
> On Thu, Mar 24, 2011 at 12:00 AM, <ni...@apache.org> wrote:
>> When trying to identify a parser for a media type in AutoDetect and similar, if the Parser
>> claims to support an alias of the media type but not the canonical one (eg someone
>> changed the mimetype file but not the parser), then have the parser accepted on the alias.
>
> It would be good if changes like this were associated with a relevant
> improvement issue in Jira. That way we can better track what was changed
> and when.
Sorry. It's all fall-out from the change in TIKA-555.
>> + // Next up, look for one for its aliases
>> + SortedSet<MediaType> aliases = registry.getAliases(type);
>> + for (MediaType alias : aliases) {
>> + parser = map.get(alias);
>> + if (parser != null) {
>> + return parser;
>> + }
>> + }
>
> As an alternative solution, how about if we simply used
> MediaTypeRegistry.normalize() in CompositeParser.getParsers() to map
> all supported types into their canonical versions. Then we wouldn't need
> to duplicate these alias lookups elsewhere and things like
> CompositeParser.getSupportedTypes() would automatically return
> normalized type names.
Yup, that'd work. The registry should also now be there (it wasn't on the
nested default parser before), so I think that'll be fine to add in.
Nick