From dev-return-6543-apmail-tika-dev-archive=tika.apache.org@tika.apache.org Sat Nov 5 19:33:13 2011 Return-Path: X-Original-To: apmail-tika-dev-archive@www.apache.org Delivered-To: apmail-tika-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 061337A85 for ; Sat, 5 Nov 2011 19:33:13 +0000 (UTC) Received: (qmail 41639 invoked by uid 500); 5 Nov 2011 19:33:12 -0000 Delivered-To: apmail-tika-dev-archive@tika.apache.org Received: (qmail 41614 invoked by uid 500); 5 Nov 2011 19:33:12 -0000 Mailing-List: contact dev-help@tika.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tika.apache.org Delivered-To: mailing list dev@tika.apache.org Received: (qmail 41606 invoked by uid 99); 5 Nov 2011 19:33:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 19:33:12 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 19:33:11 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 88E9136C53 for ; Sat, 5 Nov 2011 19:32:51 +0000 (UTC) Date: Sat, 5 Nov 2011 19:32:51 +0000 (UTC) From: "Jukka Zitting (Resolved) (JIRA)" To: dev@tika.apache.org Message-ID: <961905084.3604.1320521571562.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <152996492.57421.1320354932473.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (TIKA-772) media type detection fails for html documents, results in text/plain instead of text/html MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/TIKA-772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jukka Zitting resolved TIKA-772. -------------------------------- Resolution: Cannot Reproduce Assignee: Jukka Zitting Works for me: {code} $ for f in *.html; do echo -n "$f: "; java -jar tika-app-1.0.jar --detect < $f; done bg.html: text/html cs.html: text/html da.html: text/html de.html: text/html el.html: text/html en.html: text/html es.html: text/html et.html: text/html fi.html: text/html fr.html: text/html hu.html: text/html it.html: text/html lt.html: text/html lv.html: text/html mt.html: text/html nl.html: text/html pl.html: text/html pt.html: text/html ro.html: text/html sk.html: text/html sl.html: text/html sv.html: text/html {code} > media type detection fails for html documents, results in text/plain instead of text/html > ----------------------------------------------------------------------------------------- > > Key: TIKA-772 > URL: https://issues.apache.org/jira/browse/TIKA-772 > Project: Tika > Issue Type: Bug > Components: mime > Affects Versions: 0.10 > Reporter: Joseph Vychtrle > Assignee: Jukka Zitting > Labels: detection, media-type > Attachments: html.zip > > > Hey, I was testing media type detection on most of the major document types, but when testing html documents of cca 5000 words that starts with : > > composed of root "html" element and "p" elements only, it always results in text/plain instead of text/html ... > {code:title=Bar.java|borderStyle=solid} > @Test > public void testMediaType() throws Exception { > List allDocs = DocumentProvider.docsAsList(); > Map failed = new HashMap(); > for (Document doc : allDocs) { > Tika tika = new Tika(); > String type = tika.detect(TikaInputStream.get(doc.getFile())); > if(!doc.getMediaType().toString().equals(type)) > failed.put(doc, type); > } > > for (Document doc : failed.keySet()) { > log.error("expected: " + doc.getMediaTypeString() + "; actual: " + failed.get(doc) + "; path to file: " + doc.getFile().getAbsolutePath()); > } > assertTrue(failed.isEmpty(), "mime type was incorrectly detected for : " + failed.size() + " documents;"); > } > {code} > Am I doing anything wrong ? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira