Author: mattmann
Date: Sun Oct 14 14:03:15 2007
New Revision: 584602
URL: http://svn.apache.org/viewvc?rev=584602&view=rev
Log:
- fix for TIKA-56
Added:
incubator/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
Modified:
incubator/tika/trunk/CHANGES.txt
incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeTypes.java
Modified: incubator/tika/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=584602&r1=584601&r2=584602&view=diff
==============================================================================
--- incubator/tika/trunk/CHANGES.txt (original)
+++ incubator/tika/trunk/CHANGES.txt Sun Oct 14 14:03:15 2007
@@ -106,3 +106,6 @@
(jukka)
48. TIKA-66 - Use Java 5 features in org.apache.tika.mime (jukka)
+
+49. TIKA-56 - Mime type detection fails with upper case file extensions such
as "PDF"
+ (mattmann)
Modified: incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeTypes.java
URL:
http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeTypes.java?rev=584602&r1=584601&r2=584602&view=diff
==============================================================================
--- incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeTypes.java
(original)
+++ incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeTypes.java Sun
Oct 14 14:03:15 2007
@@ -167,7 +167,7 @@
* <code>null</code> if none is found.
*/
public MimeType getMimeType(String name) {
- MimeType type = patterns.matches(name);
+ MimeType type = patterns.matches(name.toLowerCase());
if (type != null)
return type;
// if it's null here, then return the default type
Added:
incubator/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
URL:
http://svn.apache.org/viewvc/incubator/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java?rev=584602&view=auto
==============================================================================
--- incubator/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
(added)
+++ incubator/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
Sun Oct 14 14:03:15 2007
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tika.mime;
+
+// Junit imports
+import junit.framework.TestCase;
+
+// Tika imports
+import org.apache.tika.config.TikaConfig;
+
+/**
+ *
+ * Test Suite for the [EMAIL PROTECTED] MimeTypes} repository.
+ *
+ */
+public class TestMimeTypes extends TestCase {
+
+ private MimeTypes repo;
+
+ public TestMimeTypes() {
+ try {
+ repo = TikaConfig.getDefaultConfig().getMimeRepository();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ public void testCaseSensitivity() {
+ MimeType type = repo.getMimeType("test.PDF");
+ assertNotNull(type);
+ assertEquals(repo.getMimeType("test.pdf"), type);
+ assertEquals(repo.getMimeType("test.PdF"), type);
+ assertEquals(repo.getMimeType("test.pdF"), type);
+ }
+
+}