From tika-commits-returnshelley94@example.net Fri Dec 21 08:28:50 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 36240 invoked from network); 21 Dec 2007 08:28:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 21 Dec 2007 08:28:50 -0000 Received: (qmail 54463 invoked by uid 500); 21 Dec 2007 08:28:39 -0000 Delivered-To: shelley94@example.net Received: (qmail 54436 invoked by uid 500); 21 Dec 2007 08:28:39 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 54427 invoked by uid 99); 21 Dec 2007 08:28:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 00:28:39 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 08:28:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7B8351A9832; Fri, 21 Dec 2007 00:28:25 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606132 - in /incubator/tika/trunk: ./ src/main/java/org/apache/tika/mime/ src/test/java/org/apache/tika/mime/ Date: Fri, 21 Dec 2007 08:28:21 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Fri Dec 21 00:28:20 2007 New Revision: 606132 URL: http://svn.apache.org/viewvc?rev=606132&view=rev Log: TIKA-107 - Remove use of assertions for argument checking - Committed patch from Niall Pemberton Added: incubator/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java Modified: incubator/tika/trunk/CHANGES.txt incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeType.java incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeTypes.java incubator/tika/trunk/src/main/java/org/apache/tika/mime/Patterns.java incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypeTest.java incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypesTest.java Modified: incubator/tika/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=606132&r1=606131&r2=606132&view=diff ============================================================================== --- incubator/tika/trunk/CHANGES.txt (original) +++ incubator/tika/trunk/CHANGES.txt Fri Dec 21 00:28:20 2007 @@ -132,3 +132,6 @@ 60. TIKA-102 - Parser implementations loading a large amount of content into a single String could be problematic (Niall Pemberton) + + 61. TIKA-107 - Remove use of assertions for argument checking (Niall Pemberton) + \ No newline at end of file Modified: incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeType.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeType.java?rev=606132&r1=606131&r2=606132&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeType.java (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/mime/MimeType.java Fri Dec 21 00:28:20 2007 @@ -46,7 +46,9 @@ * <code>false</code> otherwise */ public static boolean isValid(String name) { - assert name != null; + if (name == null) { + throw new IllegalArgumentException("Name is missing"); + } boolean slash = false; for (int i = 0; i < name.length(); i++) { @@ -117,8 +119,12 @@ * @param name media type name */ MimeType(MimeTypes registry, String name) { - assert registry != null; - assert isValid(name) && name.equals(name.toLowerCase()); + if (registry == null) { + throw new IllegalArgumentException("Registry is missing"); + } + if (!MimeType.isValid(name) || !name.equals(name.toLowerCase())) { + throw new IllegalArgumentException("Media type name is invalid"); + } this.registry = registry; this.name = name; } @@ -142,7 +148,12 @@ } public void setSuperType(MimeType type) throws MimeTypeException { - assert type != null && type.registry == registry; + if (type == null) { + throw new IllegalArgumentException("MimeType is missing"); + } + if (type.registry != registry) { + throw new IllegalArgumentException("MimeType is from a different registry"); + } if (this.isDescendantOf(type)) { // ignore, already a descendant of the given type } else if (this == type) { @@ -169,7 +180,9 @@ } public boolean isDescendantOf(MimeType type) { - assert type != null; + if (type == null) { + throw new IllegalArgumentException("MimeType is missing"); + } synchronized (registry) { for (MimeType t = superType; t != null; t = t.superType) { if (t == type) { @@ -195,7 +208,9 @@ * @param description media type description */ public void setDescription(String description) { - assert description != null; + if (description == null) { + throw new IllegalArgumentException("Description is missing"); + } this.description = description; } @@ -360,7 +375,9 @@ //----------------------------------------------------------< Comparable > public int compareTo(MimeType type) { - assert type != null; + if (type == null) { + throw new IllegalArgumentException("MimeType is missing"); + } if (type == this) { return 0; } else if (this.isDescendantOf(type)) { 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=606132&r1=606131&r2=606132&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 Fri Dec 21 00:28:20 2007 @@ -120,7 +120,9 @@ * @return matching MIME type, or <code>null</code> if no match is found */ public MimeType getMimeType(byte[] data) { - assert data != null; + if (data == null) { + throw new IllegalArgumentException("Data is missing"); + } // First, check for XML descriptions (level by level) for (MimeType type : xmls) { @@ -166,7 +168,9 @@ * @throws IOException if the stream can not be read */ private byte[] readMagicHeader(InputStream stream) throws IOException { - assert stream != null; + if (stream == null) { + throw new IllegalArgumentException("InputStream is missing"); + } byte[] bytes = new byte[getMinLength()]; int totalRead = 0; Modified: incubator/tika/trunk/src/main/java/org/apache/tika/mime/Patterns.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/mime/Patterns.java?rev=606132&r1=606131&r2=606132&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/mime/Patterns.java (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/mime/Patterns.java Fri Dec 21 00:28:20 2007 @@ -58,7 +58,9 @@ }); public void add(String pattern, MimeType type) throws MimeTypeException { - assert pattern != null && type != null; + if (pattern == null || type == null) { + throw new IllegalArgumentException("Pattern and/or mime type is missing"); + } if (pattern.indexOf('*') == -1 && pattern.indexOf('?') == -1 @@ -128,7 +130,9 @@ * (since this covers the majority of the patterns). */ public MimeType matches(String name) { - assert name != null; + if (name == null) { + throw new IllegalArgumentException("Name is missing"); + } // First, try exact match of the provided resource name if (names.containsKey(name)) { Modified: incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypeTest.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypeTest.java?rev=606132&r1=606131&r2=606132&view=diff ============================================================================== --- incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypeTest.java (original) +++ incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypeTest.java Fri Dec 21 00:28:20 2007 @@ -20,6 +20,50 @@ public class MimeTypeTest extends TestCase { + private MimeTypes types; + private MimeType text; + + protected void setUp() throws MimeTypeException { + types = new MimeTypes(); + text = types.forName("text/plain"); + } + + /** Test MimeType constructor */ + public void testConstrctor() { + + // Missing registry + try { + new MimeType(null, "text/plain"); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + + // Missing name + try { + new MimeType(types, null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + + // Invalid name (no slash) + try { + new MimeType(types, "application"); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + + // Invalid name (not lower case) + try { + new MimeType(types, "TEXT/PLAIN"); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } + public void testIsValidName() { assertTrue(MimeType.isValid("application/octet-stream")); assertTrue(MimeType.isValid("text/plain")); @@ -35,6 +79,32 @@ assertFalse(MimeType.isValid("application/\u00f6ctet-stream")); assertFalse(MimeType.isValid("text/plain;")); assertFalse(MimeType.isValid("text/plain; charset=UTF-8")); + try { + MimeType.isValid(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } + + /** Test MimeType setDescription() */ + public void testSetDescription() { + try { + text.setDescription(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } + + /** Test MimeType setSuperType() */ + public void testSetSuperType() throws MimeTypeException { + try { + text.setSuperType(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } } } Modified: incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypesTest.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypesTest.java?rev=606132&r1=606131&r2=606132&view=diff ============================================================================== --- incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypesTest.java (original) +++ incubator/tika/trunk/src/test/java/org/apache/tika/mime/MimeTypesTest.java Fri Dec 21 00:28:20 2007 @@ -16,6 +16,8 @@ */ package org.apache.tika.mime; +import java.io.IOException; +import java.io.InputStream; import junit.framework.TestCase; public class MimeTypesTest extends TestCase { @@ -90,6 +92,13 @@ assertTrue(html.isDescendantOf(text)); assertFalse(text.isDescendantOf(html)); + + try { + binary.isDescendantOf(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } } public void testCompareTo() { @@ -104,6 +113,33 @@ assertTrue(html.compareTo(binary) > 0); assertTrue(html.compareTo(text) > 0); assertTrue(html.compareTo(html) == 0); + + try { + binary.compareTo(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } + + /** Test getMimeType(byte[]) */ + public void testGetMimeType_byteArray() { + try { + types.getMimeType((byte[])null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } + + /** Test getMimeType(InputStream) */ + public void testGetMimeType_InputStream() throws IOException { + try { + types.getMimeType((InputStream)null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } } } Added: incubator/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java?rev=606132&view=auto ============================================================================== --- incubator/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java (added) +++ incubator/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java Fri Dec 21 00:28:20 2007 @@ -0,0 +1,72 @@ +/* + * 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; + +import java.io.IOException; +import java.io.InputStream; + +import junit.framework.TestCase; + +/** + * Test case for {@link Patterns}. + * + * @version $Id$ + */ +public class PatternsTest extends TestCase { + + private Patterns patterns; + private MimeTypes types; + private MimeType text; + + protected void setUp() throws MimeTypeException { + patterns = new Patterns(); + types = new MimeTypes(); + text = types.forName("text/plain"); + } + + /** Test add() */ + public void testAdd() throws MimeTypeException { + try { + patterns.add(null, text); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + try { + patterns.add("", null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + try { + patterns.add(null, null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } + + /** Test matches() */ + public void testMatches() { + try { + patterns.matches(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected result + } + } +} From tika-commits-returnshelley94@example.net Fri Dec 21 09:01:33 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 45642 invoked from network); 21 Dec 2007 09:01:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 21 Dec 2007 09:01:33 -0000 Received: (qmail 86426 invoked by uid 500); 21 Dec 2007 09:01:23 -0000 Delivered-To: shelley94@example.net Received: (qmail 86405 invoked by uid 500); 21 Dec 2007 09:01:23 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 86396 invoked by uid 99); 21 Dec 2007 09:01:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 01:01:22 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 09:01:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5ADD91A9832; Fri, 21 Dec 2007 01:01:09 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606139 - in /incubator/tika/trunk: ./ src/main/java/org/apache/tika/exception/ src/main/java/org/apache/tika/parser/pdf/ src/main/java/org/apache/tika/sax/ src/test/java/org/apache/tika/exception/ Date: Fri, 21 Dec 2007 09:01:08 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Fri Dec 21 01:01:07 2007 New Revision: 606139 URL: http://svn.apache.org/viewvc?rev=606139&view=rev Log: TIKA-104 - Add utility methods to throw IOException with the caused intialized - Added an IOException subclass instead - Adapted code from Niall Pemberton's patch Added: incubator/tika/trunk/src/main/java/org/apache/tika/exception/CauseIOException.java incubator/tika/trunk/src/test/java/org/apache/tika/exception/ incubator/tika/trunk/src/test/java/org/apache/tika/exception/CauseIOExceptionTest.java Modified: incubator/tika/trunk/CHANGES.txt incubator/tika/trunk/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java incubator/tika/trunk/src/main/java/org/apache/tika/sax/AppendableAdaptor.java Modified: incubator/tika/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=606139&r1=606138&r2=606139&view=diff ============================================================================== --- incubator/tika/trunk/CHANGES.txt (original) +++ incubator/tika/trunk/CHANGES.txt Fri Dec 21 01:01:07 2007 @@ -133,5 +133,7 @@ 60. TIKA-102 - Parser implementations loading a large amount of content into a single String could be problematic (Niall Pemberton) - 61. TIKA-107 - Remove use of assertions for argument checking (Niall Pemberton) - \ No newline at end of file +61. TIKA-107 - Remove use of assertions for argument checking (Niall Pemberton) + +62. TIKA-104 - Add utility methods to throw IOException with the caused + intialized (jukka & Niall Pemberton) Added: incubator/tika/trunk/src/main/java/org/apache/tika/exception/CauseIOException.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/exception/CauseIOException.java?rev=606139&view=auto ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/exception/CauseIOException.java (added) +++ incubator/tika/trunk/src/main/java/org/apache/tika/exception/CauseIOException.java Fri Dec 21 01:01:07 2007 @@ -0,0 +1,51 @@ +/** + * 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.exception; + +/** + * IOException subclass with the {@link Throwable} constructor that's + * missing before Java 6. + */ +public class CauseIOException extends java.io.IOException { + + /** + * Creates an IOException with the given message. + * + * @param message exception message + */ + public CauseIOException(String message) { + super(message); + } + + /** + * Creates an IOException with the given message and root cause. + * <p> + * This constructor was not added in the underlying + * {@link java.io.IOException) class until Java 6. + * This is a convenience method which uses the + * {@link #IOException(String)} constructor and calls the + * {@link #initCause(Throwable)} method to set the root cause. + * + * @param message exception message + * @param cause root cause + */ + public CauseIOException(String message, Throwable cause) { + this(message); + initCause(cause); + } + +} Modified: incubator/tika/trunk/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java?rev=606139&r1=606138&r2=606139&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java Fri Dec 21 01:01:07 2007 @@ -18,6 +18,7 @@ import java.io.IOException; +import org.apache.tika.exception.CauseIOException; import org.apache.tika.exception.TikaException; import org.apache.tika.metadata.Metadata; import org.apache.tika.sax.XHTMLContentHandler; @@ -70,7 +71,7 @@ try { handler.startDocument(); } catch (SAXException e) { - throw new IOException("Unable to start a document: reason: "+e.getMessage()); + throw new CauseIOException("Unable to start a document", e); } } @@ -78,7 +79,7 @@ try { handler.endDocument(); } catch (SAXException e) { - throw new IOException("Unable to end a document: reason: "+e.getMessage()); + throw new CauseIOException("Unable to end a document", e); } } @@ -86,7 +87,7 @@ try { handler.startElement("div"); } catch (SAXException e) { - throw new IOException("Unable to start a page: reason: "+e.getMessage()); + throw new CauseIOException("Unable to start a page", e); } } @@ -94,7 +95,7 @@ try { handler.endElement("div"); } catch (SAXException e) { - throw new IOException("Unable to end a page: reason: "+e.getMessage()); + throw new CauseIOException("Unable to end a page", e); } } @@ -102,7 +103,7 @@ try { handler.startElement("p"); } catch (SAXException e) { - throw new IOException("Unable to start a paragraph: reason: "+e.getMessage()); + throw new CauseIOException("Unable to start a paragraph", e); } } @@ -110,7 +111,7 @@ try { handler.endElement("p"); } catch (SAXException e) { - throw new IOException("Unable to end a paragraph: reason: "+e.getMessage()); + throw new CauseIOException("Unable to end a paragraph", e); } } @@ -118,7 +119,8 @@ try { handler.characters(text.getCharacter()); } catch (SAXException e) { - throw new IOException("Unable to write a newline: reason: "+e.getMessage()); + throw new CauseIOException( + "Unable to write a character: " + text.getCharacter(), e); } } @@ -126,7 +128,7 @@ try { handler.characters("\n"); } catch (SAXException e) { - throw new IOException("Unable to write a newline: reason: "+e.getMessage()); + throw new CauseIOException("Unable to write a newline", e); } } @@ -135,7 +137,7 @@ try { handler.characters(" "); } catch (SAXException e) { - throw new IOException("Unable to write a space: reason: "+e.getMessage()); + throw new CauseIOException("Unable to write a space", e); } } Modified: incubator/tika/trunk/src/main/java/org/apache/tika/sax/AppendableAdaptor.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/sax/AppendableAdaptor.java?rev=606139&r1=606138&r2=606139&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/sax/AppendableAdaptor.java (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/sax/AppendableAdaptor.java Fri Dec 21 01:01:07 2007 @@ -17,6 +17,8 @@ package org.apache.tika.sax; import java.io.IOException; + +import org.apache.tika.exception.CauseIOException; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; @@ -97,7 +99,9 @@ char[] chars = charSeq.toString().toCharArray(); handler.characters(chars, start, (end - start)); } catch (SAXException e) { - throw new IOException(e.toString()); + throw new CauseIOException( + "Error processing character content: " + + charSeq.subSequence(start, end), e); } } return this; Added: incubator/tika/trunk/src/test/java/org/apache/tika/exception/CauseIOExceptionTest.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/test/java/org/apache/tika/exception/CauseIOExceptionTest.java?rev=606139&view=auto ============================================================================== --- incubator/tika/trunk/src/test/java/org/apache/tika/exception/CauseIOExceptionTest.java (added) +++ incubator/tika/trunk/src/test/java/org/apache/tika/exception/CauseIOExceptionTest.java Fri Dec 21 01:01:07 2007 @@ -0,0 +1,46 @@ +/** + * 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.exception; + +import junit.framework.TestCase; + +/** + * Unit tests for the {@link CauseIOException} class. + */ +public class CauseIOExceptionTest extends TestCase { + + /** + * Test for the {@link CauseIOException#IOException(String)} constructor. + */ + public void testIOExceptionString() { + CauseIOException exception = new CauseIOException("message"); + assertEquals("message", exception.getMessage()); + assertNull(exception.getCause()); + } + + /** + * Test for the {@link IOException#IOException(String, Throwable))} + * constructor. + */ + public void testIOExceptionStringThrowable() { + Throwable cause = new IllegalArgumentException("cause"); + CauseIOException exception = new CauseIOException("message", cause); + assertEquals("message", exception.getMessage()); + assertEquals(cause, exception.getCause()); + } + +} From tika-commits-returnshelley94@example.net Fri Dec 21 09:12:54 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 48409 invoked from network); 21 Dec 2007 09:12:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 21 Dec 2007 09:12:54 -0000 Received: (qmail 92222 invoked by uid 500); 21 Dec 2007 09:12:43 -0000 Delivered-To: shelley94@example.net Received: (qmail 92195 invoked by uid 500); 21 Dec 2007 09:12:43 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 92185 invoked by uid 99); 21 Dec 2007 09:12:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 01:12:43 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 09:12:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 130581A9832; Fri, 21 Dec 2007 01:12:22 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606140 - in /incubator/tika/trunk: ./ src/main/java/org/apache/tika/parser/ src/main/java/org/apache/tika/utils/ src/test/java/org/apache/tika/utils/ Date: Fri, 21 Dec 2007 09:12:21 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Fri Dec 21 01:12:20 2007 New Revision: 606140 URL: http://svn.apache.org/viewvc?rev=606140&view=rev Log: TIKA-106 - Remove dependency on Jakarta ORO - use JDK 1.4 Regex - Patch from Niall Pemberton Added: incubator/tika/trunk/src/test/java/org/apache/tika/utils/ incubator/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java Modified: incubator/tika/trunk/CHANGES.txt incubator/tika/trunk/pom.xml incubator/tika/trunk/src/main/java/org/apache/tika/parser/ParserPostProcessor.java incubator/tika/trunk/src/main/java/org/apache/tika/utils/RegexUtils.java Modified: incubator/tika/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=606140&r1=606139&r2=606140&view=diff ============================================================================== --- incubator/tika/trunk/CHANGES.txt (original) +++ incubator/tika/trunk/CHANGES.txt Fri Dec 21 01:12:20 2007 @@ -137,3 +137,6 @@ 62. TIKA-104 - Add utility methods to throw IOException with the caused intialized (jukka & Niall Pemberton) + +63. TIKA-106 - Remove dependency on Jakarta ORO - use JDK 1.4 Regex + (Niall Pemberton) Modified: incubator/tika/trunk/pom.xml URL: http://svn.apache.org/viewvc/incubator/tika/trunk/pom.xml?rev=606140&r1=606139&r2=606140&view=diff ============================================================================== --- incubator/tika/trunk/pom.xml (original) +++ incubator/tika/trunk/pom.xml Fri Dec 21 01:12:20 2007 @@ -195,11 +195,6 @@ <version>1.1.1</version> </dependency> <dependency> - <groupId>oro</groupId> - <artifactId>oro</artifactId> - <version>2.0.8</version> - </dependency> - <dependency> <groupId>nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>0.9.5</version> Modified: incubator/tika/trunk/src/main/java/org/apache/tika/parser/ParserPostProcessor.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/parser/ParserPostProcessor.java?rev=606140&r1=606139&r2=606140&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/parser/ParserPostProcessor.java (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/parser/ParserPostProcessor.java Fri Dec 21 01:12:20 2007 @@ -20,7 +20,6 @@ import java.io.InputStream; import java.io.StringWriter; -import org.apache.oro.text.regex.MalformedPatternException; import org.apache.tika.exception.TikaException; import org.apache.tika.metadata.Metadata; import org.apache.tika.sax.TeeContentHandler; @@ -38,11 +37,6 @@ */ public class ParserPostProcessor extends ParserDecorator { - private static final String LINK_PATTERN = - "([A-Za-z][A-Za-z0-9+.-]{1,120}:" - + "[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@&~=-])|%[A-Fa-f0-9]{2}){1,333}" - + "(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@&~=%-]{0,1000}))?)"; - /** * Creates a post-processing decorator for the given parser. * @@ -70,12 +64,8 @@ int length = Math.min(content.length(), 500); metadata.set("summary", content.substring(0, length)); - try { - for (String link : RegexUtils.extract(content, LINK_PATTERN)) { - metadata.add("outlinks", link); - } - } catch (MalformedPatternException e) { - throw new TikaException("Malformed URL pattern", e); + for (String link : RegexUtils.extractLinks(content)) { + metadata.add("outlinks", link); } } Modified: incubator/tika/trunk/src/main/java/org/apache/tika/utils/RegexUtils.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/utils/RegexUtils.java?rev=606140&r1=606139&r2=606140&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/utils/RegexUtils.java (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/utils/RegexUtils.java Fri Dec 21 01:12:20 2007 @@ -17,17 +17,10 @@ package org.apache.tika.utils; import java.util.ArrayList; +import java.util.Collections; import java.util.List; - -import org.apache.log4j.Logger; -import org.apache.oro.text.regex.MalformedPatternException; -import org.apache.oro.text.regex.MatchResult; -import org.apache.oro.text.regex.Pattern; -import org.apache.oro.text.regex.PatternCompiler; -import org.apache.oro.text.regex.PatternMatcher; -import org.apache.oro.text.regex.PatternMatcherInput; -import org.apache.oro.text.regex.Perl5Compiler; -import org.apache.oro.text.regex.Perl5Matcher; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Inspired from Nutch code class OutlinkExtractor. Apply regex to extract @@ -37,32 +30,37 @@ */ public class RegexUtils { - static Logger logger = Logger.getRootLogger(); - - public static List<String> extract(String content, String regex) - throws MalformedPatternException { + /** + * Regex pattern to get URLs within a plain text. + * + * @see <a + * href="http://www.truerwords.net/articles/ut/urlactivation.html">http://www.truerwords.net/articles/ut/urlactivation.html + * </a> + */ + private static final String LINKS_REGEX = + "([A-Za-z][A-Za-z0-9+.-]{1,120}:" + + "[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@&~=-])|%[A-Fa-f0-9]{2}){1,333}" + + "(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@&~=%-]{0,1000}))?)"; + + private static final Pattern LINKS_PATTERN = Pattern.compile(LINKS_REGEX, Pattern.CASE_INSENSITIVE + Pattern.MULTILINE); + + /** + * Extract urls from plain text. + * + * @param content The plain text content to examine + * @return List of urls within found in the plain text + */ + public static List<String> extractLinks(String content) { + if (content == null || content.length() == 0) { + return Collections.emptyList(); + } List<String> extractions = new ArrayList<String>(); - final PatternCompiler cp = new Perl5Compiler(); - final Pattern pattern = cp.compile(regex, - Perl5Compiler.CASE_INSENSITIVE_MASK - | Perl5Compiler.READ_ONLY_MASK - | Perl5Compiler.MULTILINE_MASK); - final PatternMatcher matcher = new Perl5Matcher(); - - final PatternMatcherInput input = new PatternMatcherInput(content); - - MatchResult result; - String extractedContent; - - while (matcher.contains(input, pattern)) { - result = matcher.getMatch(); - extractedContent = result.group(0); - extractions.add(extractedContent); + final Matcher matcher = LINKS_PATTERN.matcher(content); + while (matcher.find()) { + extractions.add(matcher.group()); } - return extractions; } - } Added: incubator/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java?rev=606140&view=auto ============================================================================== --- incubator/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java (added) +++ incubator/tika/trunk/src/test/java/org/apache/tika/utils/RegexUtilsTest.java Fri Dec 21 01:12:20 2007 @@ -0,0 +1,79 @@ +/** + * 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.utils; + +import java.util.List; +import junit.framework.TestCase; + +/** + * Test case for {@link RegexUtils}. + * + * @version $Revision$ $Date$ + */ +public class RegexUtilsTest extends TestCase { + + /** + * Test {@link RegexUtils#extractLinks(String)} with no links. + */ + + public void testExtractLinksNone() { + List<String> links = null; + + links = RegexUtils.extractLinks(null); + assertNotNull(links); + assertEquals(0, links.size()); + + links = RegexUtils.extractLinks(""); + assertNotNull(links); + assertEquals(0, links.size()); + + links = RegexUtils.extractLinks( + "Test with no links " + + "What about www.google.com"); + assertNotNull(links); + assertEquals(0, links.size()); + } + + + /** + * Test {@link RegexUtils#extractLinks(String)} for http. + */ + public void testExtractLinksHttp() { + List<String> links = RegexUtils.extractLinks( + "Test with http://www.nutch.org/index.html is it found? " + + "What about www.google.com at http://www.google.de " + + "A longer URL could be http://www.sybit.com/solutions/portals.html"); + + assertTrue("Url not found!", links.size() == 3); + assertEquals("Wrong URL", "http://www.nutch.org/index.html", links.get(0)); + assertEquals("Wrong URL", "http://www.google.de", links.get(1)); + assertEquals("Wrong URL", "http://www.sybit.com/solutions/portals.html", links.get(2)); + } + + /** + * Test {@link RegexUtils#extractLinks(String)} for ftp. + */ + public void testExtractLinksFtp() { + List<String> links = RegexUtils.extractLinks( + "Test with ftp://www.nutch.org is it found? " + + "What about www.google.com at ftp://www.google.de"); + + assertTrue("Url not found!", links.size() == 2); + assertEquals("Wrong URL", "ftp://www.nutch.org", links.get(0)); + assertEquals("Wrong URL", "ftp://www.google.de", links.get(1)); + } +} From tika-commits-returnshelley94@example.net Fri Dec 21 09:17:36 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 49482 invoked from network); 21 Dec 2007 09:17:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 21 Dec 2007 09:17:36 -0000 Received: (qmail 127 invoked by uid 500); 21 Dec 2007 09:17:26 -0000 Delivered-To: shelley94@example.net Received: (qmail 99993 invoked by uid 500); 21 Dec 2007 09:17:26 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 99984 invoked by uid 99); 21 Dec 2007 09:17:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 01:17:25 -0800 X-ASF-Spam-Status: No, hits=-98.0 required=10.0 tests=ALL_TRUSTED,URIBL_BLACK X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 09:17:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CF4F51A9832; Fri, 21 Dec 2007 01:17:15 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606141 - /incubator/tika/trunk/src/main/java/org/apache/tika/parser/microsoft/ExcelEventParser.java Date: Fri, 21 Dec 2007 09:17:15 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Fri Dec 21 01:17:15 2007 New Revision: 606141 URL: http://svn.apache.org/viewvc?rev=606141&view=rev Log: TIKA-105 - Excel parser implementation based on POI's Event API - New class contributed by Niall Pemberton Added: incubator/tika/trunk/src/main/java/org/apache/tika/parser/microsoft/ExcelEventParser.java Added: incubator/tika/trunk/src/main/java/org/apache/tika/parser/microsoft/ExcelEventParser.java URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/parser/microsoft/ExcelEventParser.java?rev=606141&view=auto ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/parser/microsoft/ExcelEventParser.java (added) +++ incubator/tika/trunk/src/main/java/org/apache/tika/parser/microsoft/ExcelEventParser.java Fri Dec 21 01:17:15 2007 @@ -0,0 +1,486 @@ +/** + * 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.parser.microsoft; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; +import org.apache.poi.hssf.eventusermodel.HSSFListener; +import org.apache.poi.hssf.eventusermodel.HSSFRequest; +import org.apache.poi.hssf.record.BOFRecord; +import org.apache.poi.hssf.record.BoundSheetRecord; +import org.apache.poi.hssf.record.CellValueRecordInterface; +import org.apache.poi.hssf.record.CountryRecord; +import org.apache.poi.hssf.record.DateWindow1904Record; +import org.apache.poi.hssf.record.EOFRecord; +import org.apache.poi.hssf.record.ExtendedFormatRecord; +import org.apache.poi.hssf.record.FormatRecord; +import org.apache.poi.hssf.record.FormulaRecord; +import org.apache.poi.hssf.record.LabelRecord; +import org.apache.poi.hssf.record.LabelSSTRecord; +import org.apache.poi.hssf.record.NumberRecord; +import org.apache.poi.hssf.record.RKRecord; +import org.apache.poi.hssf.record.Record; +import org.apache.poi.hssf.record.SSTRecord; +import org.apache.poi.hssf.record.UnicodeString; +import org.apache.poi.poifs.filesystem.DocumentInputStream; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Excel parser implementation which uses POI's Event API + * to handle the contents of a Workbook. + * <p> + * This is an alternative implementation to Tika's + * {@link ExcelParser} implementation which uses POI's + * <code>HSSFWorkbook</code> to parse excel files. + * <p> + * The Event API uses a much smaller memory footprint than + * <code>HSSFWorkbook</code> when processing excel files + * but at the cost of more complexity. + * <p> + * With the Event API a <i>listener</i> is registered for + * specific record types and those records are created, + * fired off to the listener and then discarded as the stream + * is being processed. + * + * @see org.apache.poi.hssf.eventusermodel.HSSFListener + * @see <a href="http://poi.apache.org/hssf/how-to.html#event_api"> + * POI Event API How To</a> + */ +public class ExcelEventParser extends OfficeParser implements Serializable { + + /** Logging instance */ + private static Log log = LogFactory.getLog(ExcelEventParser.class); + + /** + * <code>true</code> if the HSSFListener should be registered + * to listen for all records or <code>false</code> if the listener + * should be configured to only receive specified records. + */ + private final boolean listenForAllRecords; + + /** + * Create an instance which only listens for the specified + * records (i.e. <code>listenForAllRecords</code> is + * <code>false</code>). + */ + public ExcelEventParser() { + this(false); + } + + /** + * Create an instance specifying whether to listen for all + * records or just for the specified few. + * <p> + * <strong>Note</strong> This constructor is intended primarily + * for testing and debugging - under normal operation + * <code>listenForAllRecords</code> should be <code>false</code>. + * + * @param listenForAllRecords <code>true</code> if the HSSFListener + * should be registered to listen for all records or <code>false</code> + * if the listener should be configured to only receive specified records. + */ + public ExcelEventParser(boolean listenForAllRecords) { + this.listenForAllRecords = listenForAllRecords; + } + + /** + * Return the content type handled by this parser. + * + * @return The content type handled + */ + protected String getContentType() { + return "application/vnd.ms-excel"; + } + + /** + * Extracts text from an Excel Workbook writing the extracted content + * to the specified {@link Appendable}. + * + * @param filesystem POI file system + * @param appendable Where to output the parsed contents + * @throws IOException if an error occurs processing the workbook + * or writing the extracted content + */ + protected void extractText(final POIFSFileSystem filesystem, + final Appendable appendable) throws IOException { + + if (log.isInfoEnabled()) { + log.info("Starting listenForAllRecords=" + listenForAllRecords); + } + + // Set up listener and register the records we want to process + TikaHSSFListener listener = new TikaHSSFListener(appendable); + HSSFRequest hssfRequest = new HSSFRequest(); + if (listenForAllRecords) { + hssfRequest.addListenerForAllRecords(listener); + } else { + hssfRequest.addListener(listener, BOFRecord.sid); + hssfRequest.addListener(listener, EOFRecord.sid); + hssfRequest.addListener(listener, DateWindow1904Record.sid); + hssfRequest.addListener(listener, CountryRecord.sid); + hssfRequest.addListener(listener, BoundSheetRecord.sid); + hssfRequest.addListener(listener, FormatRecord.sid); + hssfRequest.addListener(listener, ExtendedFormatRecord.sid); + hssfRequest.addListener(listener, SSTRecord.sid); + hssfRequest.addListener(listener, FormulaRecord.sid); + hssfRequest.addListener(listener, LabelRecord.sid); + hssfRequest.addListener(listener, LabelSSTRecord.sid); + hssfRequest.addListener(listener, NumberRecord.sid); + hssfRequest.addListener(listener, RKRecord.sid); + } + + // Create event factory and process Workbook (fire events) + DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook"); + HSSFEventFactory eventFactory = new HSSFEventFactory(); + eventFactory.processEvents(hssfRequest, documentInputStream); + + if (log.isInfoEnabled()) { + log.info("Processed " + listener.getRecordCount() + " records"); + } + } + + // ====================================================================== + + /** + * HSSF Listener implementation which processes the HSSF records. + */ + private static class TikaHSSFListener implements HSSFListener, Serializable { + + /** Logging instance */ + private static Log log = LogFactory.getLog(ExcelEventParser.class); + + private final Appendable appendable; + private int recordCount; + private SSTRecord sstRecord; + private Map<Short, String> formats = new HashMap<Short, String>(); + private Map<Short, Short> extendedFormats = new HashMap<Short, Short>(); + private List<String> sheetNames = new ArrayList<String>(); + private short bofRecordType; + private short defualtCountry; + private short currentCountry; + private short currentXFormatIdx; + private short currentSheetIndex; + private String currentSheetName; + private boolean firstElement = true; + private boolean use1904windowing = false; + + /** + * Contstruct a new listener instance outputting parsed data to + * the specified Appendable. + * + * @param appendable Destination to write the parsed output to + */ + private TikaHSSFListener(final Appendable appendable) { + this.appendable = appendable; + } + + /** + * Return a count of the number of records processed. + * + * @return The number of records processed by this listener + */ + private int getRecordCount() { + return recordCount; + } + + /** + * Process a HSSF record. + * + * @param record HSSF Record + */ + public void processRecord(final Record record) { + recordCount++; + final short sid = record.getSid(); + switch (sid) { + + /* BOFRecord: indicates start of workbook, worksheet etc. records */ + case BOFRecord.sid: + BOFRecord bofRecord = (BOFRecord)record; + bofRecordType = bofRecord.getType(); + switch (bofRecordType) { + case BOFRecord.TYPE_WORKBOOK: + currentSheetIndex = -1; + debug(record, ".Workbook"); + break; + case BOFRecord.TYPE_WORKSHEET: + currentSheetIndex++; + currentSheetName = null; + if (currentSheetIndex < sheetNames.size()) { + currentSheetName = sheetNames.get(currentSheetIndex); + } + if (log.isDebugEnabled()) { + debug(record, ".Worksheet[" + currentSheetIndex + + "], Name=[" + currentSheetName + "]"); + } + addText(currentSheetName); + break; + default: + if (log.isDebugEnabled()) { + debug(record, "[" + bofRecordType + "]"); + } + break; + } + break; + + /* BOFRecord: indicates end of workbook, worksheet etc. records */ + case EOFRecord.sid: + debug(record); + bofRecordType = 0; + break; + + /* Indicates whether to use 1904 Date Windowing or not */ + case DateWindow1904Record.sid: + DateWindow1904Record dw1904Rec = (DateWindow1904Record)record; + use1904windowing = (dw1904Rec.getWindowing() == 1); + if (log.isDebugEnabled()) { + debug(record, "[" + use1904windowing + "]"); + } + break; + + /* CountryRecord: holds all the strings for LabelSSTRecords */ + case CountryRecord.sid: + CountryRecord countryRecord = (CountryRecord)record; + defualtCountry = countryRecord.getDefaultCountry(); + currentCountry = countryRecord.getCurrentCountry(); + if (log.isDebugEnabled()) { + debug(record, " default=[" + defualtCountry + + "], current=[" + currentCountry + "]"); + } + break; + + /* SSTRecord: holds all the strings for LabelSSTRecords */ + case SSTRecord.sid: + sstRecord = (SSTRecord)record; + debug(record); + break; + + /* BoundSheetRecord: Worksheet index record */ + case BoundSheetRecord.sid: + BoundSheetRecord boundSheetRecord = (BoundSheetRecord)record; + String sheetName = boundSheetRecord.getSheetname(); + sheetNames.add(sheetName); + if (log.isDebugEnabled()) { + debug(record, "[" + sheetNames.size() + + "], Name=[" + sheetName + "]"); + } + break; + + /* FormatRecord */ + case FormatRecord.sid: + FormatRecord formatRecord = (FormatRecord)record; + String dataFormat = formatRecord.getFormatString(); + short formatIdx = formatRecord.getIndexCode(); + formats.put(formatIdx, dataFormat); + if (log.isDebugEnabled()) { + debug(record, "[" + formatIdx + "]=[" + dataFormat + "]"); + } + break; + + /* ExtendedFormatRecord */ + case ExtendedFormatRecord.sid: + ExtendedFormatRecord xFormatRecord = (ExtendedFormatRecord)record; + if (xFormatRecord.getXFType() == ExtendedFormatRecord.XF_CELL) { + short dataFormatIdx = xFormatRecord.getFormatIndex(); + if (dataFormatIdx > 0) { + extendedFormats.put(currentXFormatIdx, dataFormatIdx); + if (log.isDebugEnabled()) { + debug(record, "[" + currentXFormatIdx + + "]=FormatRecord[" + dataFormatIdx + "]"); + } + } + } + currentXFormatIdx++; + break; + + default: + if (bofRecordType == BOFRecord.TYPE_WORKSHEET + && record instanceof CellValueRecordInterface) { + processCellValue(sid, (CellValueRecordInterface)record); + } else { + debug(record); + } + break; + } + } + + /** + * Process a Cell Value record. + * + * @param sid record type identifier + * @param record The cell value record + */ + private void processCellValue(final short sid, + final CellValueRecordInterface record) { + + short xfIdx = record.getXFIndex(); + Short dfIdx = extendedFormats.get(xfIdx); + String dataFormat = dfIdx != null ? formats.get(dfIdx) : null; + String str = null; + switch (sid) { + + /* FormulaRecord: Cell value from a formula */ + case FormulaRecord.sid: + FormulaRecord formulaRecord = (FormulaRecord)record; + double fmlValue = formulaRecord.getValue(); + str = toString(fmlValue, dfIdx, dataFormat); + str = addText(str); + break; + + /* LabelRecord: strings stored directly in the cell */ + case LabelRecord.sid: + LabelRecord labelRecord = (LabelRecord)record; + str = addText(labelRecord.getValue()); + break; + + /* LabelSSTRecord: Ref. a string in the shared string table */ + case LabelSSTRecord.sid: + LabelSSTRecord labelSSTRecord = (LabelSSTRecord)record; + int sstIndex = labelSSTRecord.getSSTIndex(); + UnicodeString unicodeStr = sstRecord.getString(sstIndex); + str = addText(unicodeStr.getString()); + break; + + /* NumberRecord: Contains a numeric cell value */ + case NumberRecord.sid: + double numValue = ((NumberRecord)record).getValue(); + if (!Double.isNaN(numValue)) { + str = Double.toString(numValue); + } + str = toString(numValue, dfIdx, dataFormat); + str = addText(str); + break; + + /* RKRecord: Excel internal number record */ + case RKRecord.sid: + double rkValue = ((RKRecord)record).getRKNumber(); + str = toString(rkValue, dfIdx, dataFormat); + str = addText(str); + break; + } + + // =========== Debug Mess: START =========== + if (log.isDebugEnabled()) { + StringBuilder builder = new StringBuilder(); + builder.append('['); + // builder.append(ExcelUtils.columnIndexToLabel(record.getColumn())); + builder.append(record.getColumn()); + builder.append(":"); + builder.append((record.getRow() + 1)); + builder.append(']'); + if (dfIdx != null) { + builder.append(" xfIdx["); + builder.append(xfIdx).append(']'); + builder.append("=dfIdx["); + builder.append(dfIdx); + builder.append(']'); + if (dataFormat != null) { + builder.append("=["); + builder.append(dataFormat); + builder.append(']'); + } + } + builder.append(", value=["); + if (str != null && str.length() > 0) { + builder.append(str); + } + builder.append(']'); + debug((Record)record, builder.toString()); + } + // =========== Debug Mess: END ============= + } + + /** + * Converts a numeric excel cell value to a String. + * + * @param value The cell value + * @param dfIdx The data format index + * @param dataFormat The data format + * @return Formatted string value + */ + private String toString(double value, Short dfIdx, String dataFormat) { + if (Double.isNaN(value)) { + return null; + } + + // **** TODO: Data Format parsing **** + // return ExcelUtils.format(value, dfIdx, dataFormat, use1904windowing); + return Double.toString(value); + } + + /** + * Add a parsed text value to this listners appendable. + * <p> + * Null and zero length values are ignored. + * + * @param text The text value + * @return the added text + */ + private String addText(String text) { + if (text != null) { + text = text.trim(); + if (text.length() > 0) { + try { + if (!firstElement) { + appendable.append(" "); + } + appendable.append(text); + } catch (Exception e) { + throw new RuntimeException(e); + } + firstElement = false; + } + } + return text; + } + + /** + * Record debugging. + * + * @param record The Record + */ + private void debug(Record record) { + debug(record, ""); + } + + /** + * Record debugging. + * + * @param record The Record + * @param msg Debug Message + */ + private void debug(Record record, String msg) { + if (log.isDebugEnabled()) { + String className = record.getClass().getSimpleName(); + String text = (msg == null ? className : className + msg); + if (record.getSid() == BOFRecord.sid || + record.getSid() == EOFRecord.sid) { + log.debug(text); + } else { + log.debug(" " + text); + } + } + } + } +} From tika-commits-returnshelley94@example.net Mon Dec 24 01:22:13 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 10136 invoked from network); 24 Dec 2007 01:22:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 24 Dec 2007 01:22:13 -0000 Received: (qmail 86592 invoked by uid 500); 24 Dec 2007 01:22:02 -0000 Delivered-To: shelley94@example.net Received: (qmail 86567 invoked by uid 500); 24 Dec 2007 01:22:01 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 86558 invoked by uid 99); 24 Dec 2007 01:22:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Dec 2007 17:22:01 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2007 01:21:58 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 95E691A9832; Sun, 23 Dec 2007 17:21:49 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606650 - in /incubator/tika/trunk: CHANGES.txt pom.xml Date: Mon, 24 Dec 2007 01:21:49 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: mattmann Date: Sun Dec 23 17:21:46 2007 New Revision: 606650 URL: http://svn.apache.org/viewvc?rev=606650&view=rev Log: - prep for 0.1-incubating release Modified: incubator/tika/trunk/CHANGES.txt incubator/tika/trunk/pom.xml Modified: incubator/tika/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=606650&r1=606649&r2=606650&view=diff ============================================================================== --- incubator/tika/trunk/CHANGES.txt (original) +++ incubator/tika/trunk/CHANGES.txt Sun Dec 23 17:21:46 2007 @@ -1,6 +1,6 @@ Tika Change Log -Unreleased changes (0.1-dev) +Unreleased changes (0.1-incubating) 1. TIKA-5 - Port Metadata Framework from Nutch (mattmann) Modified: incubator/tika/trunk/pom.xml URL: http://svn.apache.org/viewvc/incubator/tika/trunk/pom.xml?rev=606650&r1=606649&r2=606650&view=diff ============================================================================== --- incubator/tika/trunk/pom.xml (original) +++ incubator/tika/trunk/pom.xml Sun Dec 23 17:21:46 2007 @@ -33,7 +33,7 @@ <groupId>org.apache.tika</groupId> <artifactId>tika</artifactId> - <version>0.1-SNAPSHOT</version> + <version>0.1-incubating</version> <name>Apache Tika</name> From tika-commits-returnshelley94@example.net Mon Dec 24 01:23:33 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 10509 invoked from network); 24 Dec 2007 01:23:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 24 Dec 2007 01:23:32 -0000 Received: (qmail 86971 invoked by uid 500); 24 Dec 2007 01:23:21 -0000 Delivered-To: shelley94@example.net Received: (qmail 86936 invoked by uid 500); 24 Dec 2007 01:23:21 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 86927 invoked by uid 99); 24 Dec 2007 01:23:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Dec 2007 17:23:21 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2007 01:23:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A754E1A9832; Sun, 23 Dec 2007 17:23:11 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606652 - /incubator/tika/branches/0.1-incubating/ Date: Mon, 24 Dec 2007 01:23:11 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: mattmann Date: Sun Dec 23 17:23:09 2007 New Revision: 606652 URL: http://svn.apache.org/viewvc?rev=606652&view=rev Log: - branch for 0.1-incubating release Added: incubator/tika/branches/0.1-incubating/ - copied from r606651, incubator/tika/trunk/ From tika-commits-returnshelley94@example.net Wed Dec 26 22:34:43 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 98201 invoked from network); 26 Dec 2007 22:34:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 26 Dec 2007 22:34:43 -0000 Received: (qmail 31417 invoked by uid 500); 26 Dec 2007 22:34:32 -0000 Delivered-To: shelley94@example.net Received: (qmail 31393 invoked by uid 500); 26 Dec 2007 22:34:32 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 31384 invoked by uid 99); 26 Dec 2007 22:34:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Dec 2007 14:34:32 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Dec 2007 22:34:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2AFA61A9832; Wed, 26 Dec 2007 14:34:22 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606961 - /incubator/tika/trunk/KEYS Date: Wed, 26 Dec 2007 22:34:21 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Wed Dec 26 14:34:21 2007 New Revision: 606961 URL: http://svn.apache.org/viewvc?rev=606961&view=rev Log: TIKA-110: Add KEYS file for Tika Added: incubator/tika/trunk/KEYS (with props) Added: incubator/tika/trunk/KEYS URL: http://svn.apache.org/viewvc/incubator/tika/trunk/KEYS?rev=606961&view=auto ============================================================================== --- incubator/tika/trunk/KEYS (added) +++ incubator/tika/trunk/KEYS Wed Dec 26 14:34:21 2007 @@ -0,0 +1,92 @@ +This file contains the PGP keys of various developers. +Please don't use them for email unless you have to. Their main +purpose is code signing. + +Users: + pgp < KEYS + gpg --import KEYS + +Developers: + pgp -kxa <your name> # and append to KEYS (this file) + (pgpk -ll <your name> && pgpk -xa <your name>) >> KEYS + (gpg --list-sigs <your name> && gpg --armor --export <your name>) >> KEYS + +---- + +pub 1024D/A355A63E 2006-09-19 +uid Jukka Zitting <shelley94@example.net> +sig 3 A355A63E 2006-09-19 Jukka Zitting <shelley94@example.net> +sig 3 A355A63E 2006-09-19 Jukka Zitting <shelley94@example.net> +sig E04F9A89 2006-10-13 Roy T. Fielding <shelley94@example.net> +sig AB821FBC 2006-10-14 Andrew McIntyre <shelley94@example.net> +sig 9992ADFC 2006-10-17 Jeff McAdams (General purpose key) <shelley94@example.net> +sig 5F7898A9 2006-10-17 William Glass-Husain <shelley94@example.net> +sig 08C975E5 2006-10-18 Jim Jagielski <shelley94@example.net> +sig BB550746 2006-10-23 J. Daniel Kulp <shelley94@example.net> +sig 9BCFCE2F 2006-10-24 Garrett Rooney <shelley94@example.net> +sig BFD0307C 2006-10-25 J Aaron Farr <shelley94@example.net> +sig 2C5E4EC0 2006-10-28 Henri Yandell (For signing ASF releases) <shelley94@example.net> +sig D872E270 2006-10-30 Bozhong Lin <shelley94@example.net> +sig 3 669C4AB5 2006-10-16 Cezar Cristian Andrei <shelley94@example.net> +sig 665E0760 2006-12-15 Afkham Azeez (WSO2 Email) <shelley94@example.net> +sig 329D80D2 2006-12-16 Sanka Samaranayake (Oxygenating The Web Service Platform) <shelley94@example.net> +sig E41EDC7E 2006-12-17 Carsten Ziegeler <shelley94@example.net> +sig 9C85222B 2007-05-14 Henning Schmiedehausen <shelley94@example.net> +sub 2048g/2542C54A 2006-09-19 +sig A355A63E 2006-09-19 Jukka Zitting <shelley94@example.net> + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.5 (GNU/Linux) + +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 +n2vnHhk+T9mBMOTPjgR9lLrdsnYg +=Mj6z +-----END PGP PUBLIC KEY BLOCK----- Propchange: incubator/tika/trunk/KEYS ------------------------------------------------------------------------------ svn:eol-style = native From tika-commits-returnshelley94@example.net Wed Dec 26 22:58:20 2007 Return-Path: <tika-commits-returnshelley94@example.net> Delivered-To: shelley94@example.net Received: (qmail 1373 invoked from network); 26 Dec 2007 22:58:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 26 Dec 2007 22:58:20 -0000 Received: (qmail 46181 invoked by uid 500); 26 Dec 2007 22:58:09 -0000 Delivered-To: shelley94@example.net Received: (qmail 46156 invoked by uid 500); 26 Dec 2007 22:58:09 -0000 Mailing-List: contact shelley94@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:shelley94@example.net> List-Unsubscribe: <mailto:shelley94@example.net> List-Post: <mailto:shelley94@example.net> List-Id: <tika-commits.incubator.apache.org> Reply-To: shelley94@example.net Delivered-To: mailing list shelley94@example.net Received: (qmail 46147 invoked by uid 99); 26 Dec 2007 22:58:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Dec 2007 14:58:09 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Dec 2007 22:57:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3B37C1A9832; Wed, 26 Dec 2007 14:57:59 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606969 - in /incubator/tika/trunk: CHANGES.txt HEADER.txt README.txt src/main/java/org/apache/tika/metadata/package.html src/main/resources/tika-config.xml src/site/SITE-README.txt src/test/resources/log4j/log4j.properties Date: Wed, 26 Dec 2007 22:57:58 -0000 To: shelley94@example.net From: shelley94@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <shelley94@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Wed Dec 26 14:57:57 2007 New Revision: 606969 URL: http://svn.apache.org/viewvc?rev=606969&view=rev Log: TIKA-111: Missing license headers - Added license headers where needed - Merged src/site/SITE-README.txt to README.txt - Added a HEADER.txt file with the standard header Added: incubator/tika/trunk/HEADER.txt Removed: incubator/tika/trunk/src/site/SITE-README.txt Modified: incubator/tika/trunk/CHANGES.txt incubator/tika/trunk/README.txt incubator/tika/trunk/src/main/java/org/apache/tika/metadata/package.html incubator/tika/trunk/src/main/resources/tika-config.xml incubator/tika/trunk/src/test/resources/log4j/log4j.properties Modified: incubator/tika/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=606969&r1=606968&r2=606969&view=diff ============================================================================== --- incubator/tika/trunk/CHANGES.txt (original) +++ incubator/tika/trunk/CHANGES.txt Wed Dec 26 14:57:57 2007 @@ -140,3 +140,5 @@ 63. TIKA-106 - Remove dependency on Jakarta ORO - use JDK 1.4 Regex (Niall Pemberton) + +64. TIKA-111 - Missing license headers (jukka) Added: incubator/tika/trunk/HEADER.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/HEADER.txt?rev=606969&view=auto ============================================================================== --- incubator/tika/trunk/HEADER.txt (added) +++ incubator/tika/trunk/HEADER.txt Wed Dec 26 14:57:57 2007 @@ -0,0 +1,16 @@ +/* + * 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. + */ Modified: incubator/tika/trunk/README.txt URL: http://svn.apache.org/viewvc/incubator/tika/trunk/README.txt?rev=606969&r1=606968&r2=606969&view=diff ============================================================================== --- incubator/tika/trunk/README.txt (original) +++ incubator/tika/trunk/README.txt Wed Dec 26 14:57:57 2007 @@ -67,3 +67,31 @@ a new feature, please visit the Tika issue tracker at https://issues.apache.org/jira/browse/TIKA. There you can also find the latest information on known issues and recent bug fixes and enhancements. + +Updating the Tika web site +========================== + +Here's how to update the live Tika website (http://incubator.apache.org/tika/) + + 1) Edit the content found in src/site + + 2) Run "mvn site" to generate the website pages + + 3) Check the new content at target/site/index.html + + 4) Checkout https://svn.apache.org/repos/asf/incubator/tika/site + and update the changed pages there + + 5) Commit your changes, both here and in the tika/site module + + 6) To activate the changes on the live website, login to + people.apache.org and run: + + umask 002; svn update /www/incubator.apache.org/tika + + 7) That directory is replicated to the live website every few hours, + so your changes can take some time to be live. + +Easy and fun, isn't it? ;-) + +This will get better once Tika graduates from the Incubator. Modified: incubator/tika/trunk/src/main/java/org/apache/tika/metadata/package.html URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/metadata/package.html?rev=606969&r1=606968&r2=606969&view=diff ============================================================================== --- incubator/tika/trunk/src/main/java/org/apache/tika/metadata/package.html (original) +++ incubator/tika/trunk/src/main/java/org/apache/tika/metadata/package.html Wed Dec 26 14:57:57 2007 @@ -1,3 +1,19 @@ +<!-- + 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
{'source': 'Apache Software Foundation Public Mail Archives'}