You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2008/12/01 00:15:11 UTC

svn commit: r721926 [4/5] - in /lucene/tika/trunk/src: main/java/org/apache/tika/cli/ main/java/org/apache/tika/gui/ main/java/org/apache/tika/mime/ main/java/org/apache/tika/parser/ main/java/org/apache/tika/parser/audio/ main/java/org/apache/tika/par...

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/CompositeMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/CompositeMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/CompositeMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/CompositeMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,61 +1,61 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Composite XPath evaluation state. Used when XPath evaluation results
- * in two or more branches of independent evaluation states.
- */
-public class CompositeMatcher extends Matcher {
-
-    private final Matcher a;
-
-    private final Matcher b;
-
-    public CompositeMatcher(Matcher a, Matcher b) {
-        this.a = a;
-        this.b = b;
-    }
-
-    public Matcher descend(String namespace, String name) {
-        Matcher a = this.a.descend(namespace, name);
-        Matcher b = this.b.descend(namespace, name);
-        if (a == FAIL) {
-            return b;
-        } else if (b == FAIL) {
-            return a;
-        } else if (this.a == a && this.b == b) {
-            return this;
-        } else {
-            return new CompositeMatcher(a, b);
-        }
-    }
-
-    public boolean matchesElement() {
-        return a.matchesElement() || b.matchesElement();
-    }
-
-    public boolean matchesAttribute(String namespace, String name) {
-        return a.matchesAttribute(namespace, name)
-            || b.matchesAttribute(namespace, name);
-    }
-
-    public boolean matchesText() {
-        return a.matchesText() || b.matchesText();
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Composite XPath evaluation state. Used when XPath evaluation results
+ * in two or more branches of independent evaluation states.
+ */
+public class CompositeMatcher extends Matcher {
+
+    private final Matcher a;
+
+    private final Matcher b;
+
+    public CompositeMatcher(Matcher a, Matcher b) {
+        this.a = a;
+        this.b = b;
+    }
+
+    public Matcher descend(String namespace, String name) {
+        Matcher a = this.a.descend(namespace, name);
+        Matcher b = this.b.descend(namespace, name);
+        if (a == FAIL) {
+            return b;
+        } else if (b == FAIL) {
+            return a;
+        } else if (this.a == a && this.b == b) {
+            return this;
+        } else {
+            return new CompositeMatcher(a, b);
+        }
+    }
+
+    public boolean matchesElement() {
+        return a.matchesElement() || b.matchesElement();
+    }
+
+    public boolean matchesAttribute(String namespace, String name) {
+        return a.matchesAttribute(namespace, name)
+            || b.matchesAttribute(namespace, name);
+    }
+
+    public boolean matchesText() {
+        return a.matchesText() || b.matchesText();
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/CompositeMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/ElementMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/ElementMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/ElementMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/ElementMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,31 +1,31 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Final evaluation state of an XPath expression that targets an element.
- * Matches the current element.
- */
-public class ElementMatcher extends Matcher {
-
-    public static final Matcher INSTANCE = new ElementMatcher();
-
-    public boolean matchesElement() {
-        return true;
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Final evaluation state of an XPath expression that targets an element.
+ * Matches the current element.
+ */
+public class ElementMatcher extends Matcher {
+
+    public static final Matcher INSTANCE = new ElementMatcher();
+
+    public boolean matchesElement() {
+        return true;
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/ElementMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/Matcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/Matcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/Matcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/Matcher.java Sun Nov 30 15:15:09 2008
@@ -1,77 +1,77 @@
-/*
- * 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.sax.xpath;
-
-/**
- * XPath element matcher. A matcher instance encapsulates a specific
- * state in XPath evaluation.
- */
-public class Matcher {
-
-    /**
-     * State of a failed XPath evaluation, where nothing is matched.
-     * This matcher instance is used as a sentinel object whenever an
-     * XPath evaluation branch fails.
-     */
-    public static final Matcher FAIL = new Matcher();
-
-    /**
-     * Returns the XPath evaluation state that results from descending
-     * to a child element with the given name.
-     *
-     * @param namespace element namespace or <code>null</code>
-     * @param name element name
-     * @return next XPath evaluation state
-     */
-    public Matcher descend(String namespace, String name) {
-        return FAIL;
-    }
-
-    /**
-     * Returns <code>true</code> if the XPath expression matches
-     * the element associated with this evaluation state.
-     *
-     * @return XPath evaluation state for this element
-     */
-    public boolean matchesElement() {
-        return false;
-    }
-
-    /**
-     * Returns <code>true</code> if the XPath expression matches the named
-     * attribute of the element associated with this evaluation state.
-     *
-     * @param namespace attribute namespace or <code>null</code>
-     * @param name attribute name
-     * @return XPath evaluation state for named attribute of this element
-     */
-    public boolean matchesAttribute(String namespace, String name) {
-        return false;
-    }
-
-    /**
-     * Returns <code>true</code> if the XPath expression matches all text
-     * nodes whose parent is the element associated with this evaluation
-     * state.
-     *
-     * @return XPath evaluation state for text children of this element
-     */
-    public boolean matchesText() {
-        return false;
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * XPath element matcher. A matcher instance encapsulates a specific
+ * state in XPath evaluation.
+ */
+public class Matcher {
+
+    /**
+     * State of a failed XPath evaluation, where nothing is matched.
+     * This matcher instance is used as a sentinel object whenever an
+     * XPath evaluation branch fails.
+     */
+    public static final Matcher FAIL = new Matcher();
+
+    /**
+     * Returns the XPath evaluation state that results from descending
+     * to a child element with the given name.
+     *
+     * @param namespace element namespace or <code>null</code>
+     * @param name element name
+     * @return next XPath evaluation state
+     */
+    public Matcher descend(String namespace, String name) {
+        return FAIL;
+    }
+
+    /**
+     * Returns <code>true</code> if the XPath expression matches
+     * the element associated with this evaluation state.
+     *
+     * @return XPath evaluation state for this element
+     */
+    public boolean matchesElement() {
+        return false;
+    }
+
+    /**
+     * Returns <code>true</code> if the XPath expression matches the named
+     * attribute of the element associated with this evaluation state.
+     *
+     * @param namespace attribute namespace or <code>null</code>
+     * @param name attribute name
+     * @return XPath evaluation state for named attribute of this element
+     */
+    public boolean matchesAttribute(String namespace, String name) {
+        return false;
+    }
+
+    /**
+     * Returns <code>true</code> if the XPath expression matches all text
+     * nodes whose parent is the element associated with this evaluation
+     * state.
+     *
+     * @return XPath evaluation state for text children of this element
+     */
+    public boolean matchesText() {
+        return false;
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/Matcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/MatchingContentHandler.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/MatchingContentHandler.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/MatchingContentHandler.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/MatchingContentHandler.java Sun Nov 30 15:15:09 2008
@@ -1,117 +1,117 @@
-/*
- * 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.sax.xpath;
-
-import java.util.LinkedList;
-
-import org.apache.tika.sax.ContentHandlerDecorator;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * Content handler decorator that only passes the elements, attributes,
- * and text nodes that match the given XPath expression. Note especially
- * that {@link #startDocument()} and {@link #endDocument()} events are not
- * passed to the decorated handler.
- */
-public class MatchingContentHandler extends ContentHandlerDecorator {
-
-    private final LinkedList<Matcher> matchers = new LinkedList<Matcher>();
-
-    private Matcher matcher;
-
-    public MatchingContentHandler(ContentHandler delegate, Matcher matcher) {
-        super(delegate);
-        this.matcher = matcher;
-    }
-
-    public void startElement(
-            String uri, String localName, String name, Attributes attributes)
-            throws SAXException {
-        matchers.addFirst(matcher);
-        matcher = matcher.descend(uri, localName);
-
-        AttributesImpl matches = new AttributesImpl();
-        for (int i = 0; i < attributes.getLength(); i++) {
-            String attributeURI = attributes.getURI(i);
-            String attributeName = attributes.getLocalName(i);
-            if (matcher.matchesAttribute(attributeURI, attributeName)) {
-                matches.addAttribute(
-                        attributeURI, attributeName, attributes.getQName(i),
-                        attributes.getType(i), attributes.getValue(i));
-            }
-        }
-
-        if (matcher.matchesElement() || matches.getLength() > 0) {
-            super.startElement(uri, localName, name, matches);
-            if (!matcher.matchesElement()) {
-                // Force the matcher to match the current element, so the
-                // endElement method knows to emit the correct event
-                matcher =
-                    new CompositeMatcher(matcher, ElementMatcher.INSTANCE);
-            }
-        }
-    }
-
-    public void endElement(String uri, String localName, String name)
-            throws SAXException {
-        if (matcher.matchesElement()) {
-            super.endElement(uri, localName, name);
-        }
-        matcher = matchers.removeFirst();
-    }
-
-    public void characters(char[] ch, int start, int length)
-            throws SAXException {
-        if (matcher.matchesText()) {
-            super.characters(ch, start, length);
-        }
-    }
-
-    public void ignorableWhitespace(char[] ch, int start, int length)
-            throws SAXException {
-        if (matcher.matchesText()) {
-            super.ignorableWhitespace(ch, start, length);
-        }
-    }
-
-    public void processingInstruction(String target, String data) {
-        // TODO: Support for matching processing instructions
-    }
-
-    public void skippedEntity(String name) throws SAXException {
-        // TODO: Can skipped entities refer to more than text?
-        if (matcher.matchesText()) {
-            super.skippedEntity(name);
-        }
-    }
-
-    /**
-     * Ignored.
-     */
-    public void startDocument() {
-    }
-
-    /**
-     * Ignored.
-     */
-    public void endDocument() {
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+import java.util.LinkedList;
+
+import org.apache.tika.sax.ContentHandlerDecorator;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Content handler decorator that only passes the elements, attributes,
+ * and text nodes that match the given XPath expression. Note especially
+ * that {@link #startDocument()} and {@link #endDocument()} events are not
+ * passed to the decorated handler.
+ */
+public class MatchingContentHandler extends ContentHandlerDecorator {
+
+    private final LinkedList<Matcher> matchers = new LinkedList<Matcher>();
+
+    private Matcher matcher;
+
+    public MatchingContentHandler(ContentHandler delegate, Matcher matcher) {
+        super(delegate);
+        this.matcher = matcher;
+    }
+
+    public void startElement(
+            String uri, String localName, String name, Attributes attributes)
+            throws SAXException {
+        matchers.addFirst(matcher);
+        matcher = matcher.descend(uri, localName);
+
+        AttributesImpl matches = new AttributesImpl();
+        for (int i = 0; i < attributes.getLength(); i++) {
+            String attributeURI = attributes.getURI(i);
+            String attributeName = attributes.getLocalName(i);
+            if (matcher.matchesAttribute(attributeURI, attributeName)) {
+                matches.addAttribute(
+                        attributeURI, attributeName, attributes.getQName(i),
+                        attributes.getType(i), attributes.getValue(i));
+            }
+        }
+
+        if (matcher.matchesElement() || matches.getLength() > 0) {
+            super.startElement(uri, localName, name, matches);
+            if (!matcher.matchesElement()) {
+                // Force the matcher to match the current element, so the
+                // endElement method knows to emit the correct event
+                matcher =
+                    new CompositeMatcher(matcher, ElementMatcher.INSTANCE);
+            }
+        }
+    }
+
+    public void endElement(String uri, String localName, String name)
+            throws SAXException {
+        if (matcher.matchesElement()) {
+            super.endElement(uri, localName, name);
+        }
+        matcher = matchers.removeFirst();
+    }
+
+    public void characters(char[] ch, int start, int length)
+            throws SAXException {
+        if (matcher.matchesText()) {
+            super.characters(ch, start, length);
+        }
+    }
+
+    public void ignorableWhitespace(char[] ch, int start, int length)
+            throws SAXException {
+        if (matcher.matchesText()) {
+            super.ignorableWhitespace(ch, start, length);
+        }
+    }
+
+    public void processingInstruction(String target, String data) {
+        // TODO: Support for matching processing instructions
+    }
+
+    public void skippedEntity(String name) throws SAXException {
+        // TODO: Can skipped entities refer to more than text?
+        if (matcher.matchesText()) {
+            super.skippedEntity(name);
+        }
+    }
+
+    /**
+     * Ignored.
+     */
+    public void startDocument() {
+    }
+
+    /**
+     * Ignored.
+     */
+    public void endDocument() {
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/MatchingContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedAttributeMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedAttributeMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedAttributeMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedAttributeMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,42 +1,42 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Final evaluation state of a <code>.../@name</code> XPath expression.
- * Matches the named attributes of the current element.
- */
-public class NamedAttributeMatcher extends Matcher {
-
-    private final String namespace;
-
-    private final String name;
-
-    public NamedAttributeMatcher(String namespace, String name) {
-        this.namespace = namespace;
-        this.name = name;
-    }
-
-    public boolean matchesAttribute(String namespace, String name) {
-        return equals(namespace, this.namespace) && name.equals(this.name);
-    }
-
-    private static boolean equals(String a, String b) {
-        return (a == null) ? (b == null) : a.equals(b);
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Final evaluation state of a <code>.../@name</code> XPath expression.
+ * Matches the named attributes of the current element.
+ */
+public class NamedAttributeMatcher extends Matcher {
+
+    private final String namespace;
+
+    private final String name;
+
+    public NamedAttributeMatcher(String namespace, String name) {
+        this.namespace = namespace;
+        this.name = name;
+    }
+
+    public boolean matchesAttribute(String namespace, String name) {
+        return equals(namespace, this.namespace) && name.equals(this.name);
+    }
+
+    private static boolean equals(String a, String b) {
+        return (a == null) ? (b == null) : a.equals(b);
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedAttributeMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedElementMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedElementMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedElementMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedElementMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,48 +1,48 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Intermediate evaluation state of a <code>.../name...</code> XPath
- * expression. Matches nothing, but specifies the evaluation state
- * for the child elements with the given name.
- */
-public class NamedElementMatcher extends ChildMatcher {
-
-    private final String namespace;
-
-    private final String name;
-
-    protected NamedElementMatcher(String namespace, String name, Matcher then) {
-        super(then);
-        this.namespace = namespace;
-        this.name = name;
-    }
-
-    public Matcher descend(String namespace, String name) {
-        if (equals(namespace, this.namespace) && name.equals(this.name)) {
-            return super.descend(namespace, name);
-        } else {
-            return FAIL;
-        }
-    }
-
-    private static boolean equals(String a, String b) {
-        return (a == null) ? (b == null) : a.equals(b);
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Intermediate evaluation state of a <code>.../name...</code> XPath
+ * expression. Matches nothing, but specifies the evaluation state
+ * for the child elements with the given name.
+ */
+public class NamedElementMatcher extends ChildMatcher {
+
+    private final String namespace;
+
+    private final String name;
+
+    protected NamedElementMatcher(String namespace, String name, Matcher then) {
+        super(then);
+        this.namespace = namespace;
+        this.name = name;
+    }
+
+    public Matcher descend(String namespace, String name) {
+        if (equals(namespace, this.namespace) && name.equals(this.name)) {
+            return super.descend(namespace, name);
+        } else {
+            return FAIL;
+        }
+    }
+
+    private static boolean equals(String a, String b) {
+        return (a == null) ? (b == null) : a.equals(b);
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NamedElementMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NodeMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NodeMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NodeMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NodeMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,42 +1,42 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Final evaluation state of a <code>.../node()</code> XPath expression.
- * Matches all elements, attributes, and text.
- */
-public class NodeMatcher extends Matcher {
-
-    public static final Matcher INSTANCE = new NodeMatcher();
-
-    @Override
-    public boolean matchesElement() {
-        return true;
-    }
-
-    @Override
-    public boolean matchesAttribute(String namespace, String name) {
-        return true;
-    }
-
-    @Override
-    public boolean matchesText() {
-        return true;
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Final evaluation state of a <code>.../node()</code> XPath expression.
+ * Matches all elements, attributes, and text.
+ */
+public class NodeMatcher extends Matcher {
+
+    public static final Matcher INSTANCE = new NodeMatcher();
+
+    @Override
+    public boolean matchesElement() {
+        return true;
+    }
+
+    @Override
+    public boolean matchesAttribute(String namespace, String name) {
+        return true;
+    }
+
+    @Override
+    public boolean matchesText() {
+        return true;
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/NodeMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/SubtreeMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/SubtreeMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/SubtreeMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/SubtreeMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,56 +1,56 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Evaluation state of a <code>...//...</code> XPath expression. Applies the
- * contained evaluation state to the current element and all its descendants.
- */
-public class SubtreeMatcher extends Matcher {
-
-    private final Matcher then;
-
-    public SubtreeMatcher(Matcher then) {
-        this.then = then;
-    }
-
-    @Override
-    public Matcher descend(String namespace, String name) {
-        Matcher next = then.descend(namespace, name);
-        if (next == FAIL || next == then) {
-            return this;
-        } else {
-            return new CompositeMatcher(next, this);
-        }
-    }
-
-    @Override
-    public boolean matchesElement() {
-        return then.matchesElement();
-    }
-
-    @Override
-    public boolean matchesAttribute(String namespace, String name) {
-        return then.matchesAttribute(namespace, name);
-    }
-
-    @Override
-    public boolean matchesText() {
-        return then.matchesText();
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Evaluation state of a <code>...//...</code> XPath expression. Applies the
+ * contained evaluation state to the current element and all its descendants.
+ */
+public class SubtreeMatcher extends Matcher {
+
+    private final Matcher then;
+
+    public SubtreeMatcher(Matcher then) {
+        this.then = then;
+    }
+
+    @Override
+    public Matcher descend(String namespace, String name) {
+        Matcher next = then.descend(namespace, name);
+        if (next == FAIL || next == then) {
+            return this;
+        } else {
+            return new CompositeMatcher(next, this);
+        }
+    }
+
+    @Override
+    public boolean matchesElement() {
+        return then.matchesElement();
+    }
+
+    @Override
+    public boolean matchesAttribute(String namespace, String name) {
+        return then.matchesAttribute(namespace, name);
+    }
+
+    @Override
+    public boolean matchesText() {
+        return then.matchesText();
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/SubtreeMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/TextMatcher.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/TextMatcher.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/TextMatcher.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/TextMatcher.java Sun Nov 30 15:15:09 2008
@@ -1,31 +1,31 @@
-/*
- * 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.sax.xpath;
-
-/**
- * Final evaluation state of a <code>.../text()</code> XPath expression.
- * Matches all text children of the current element.
- */
-public class TextMatcher extends Matcher {
-
-    public static final Matcher INSTANCE = new TextMatcher();
-
-    public boolean matchesText() {
-        return true;
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+/**
+ * Final evaluation state of a <code>.../text()</code> XPath expression.
+ * Matches all text children of the current element.
+ */
+public class TextMatcher extends Matcher {
+
+    public static final Matcher INSTANCE = new TextMatcher();
+
+    public boolean matchesText() {
+        return true;
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/TextMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/XPathParser.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/XPathParser.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/XPathParser.java (original)
+++ lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/XPathParser.java Sun Nov 30 15:15:09 2008
@@ -1,114 +1,114 @@
-/*
- * 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.sax.xpath;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Parser for a very simple XPath subset. Only the following XPath constructs
- * (with namespaces) are supported:
- * <ul>
- *   <li><code>.../text()</code></li>
- *   <li><code>.../@*</code></li>
- *   <li><code>.../@name</code></li>
- *   <li><code>.../*...</code></li>
- *   <li><code>.../name...</code></li>
- *   <li><code>...//*...</code></li>
- *   <li><code>...//name...</code></li>
- * </ul>
- */
-public class XPathParser {
-
-    private final Map<String, String> prefixes = new HashMap<String, String>();
-
-    public XPathParser() {
-    }
-
-    public XPathParser(String prefix, String namespace) {
-        addPrefix(prefix, namespace);
-    }
-
-    public void addPrefix(String prefix, String namespace) {
-        prefixes.put(prefix, namespace);
-    }
-
-    /**
-     * Parses the given simple XPath expression to an evaluation state
-     * initialized at the document node. Invalid expressions are not flagged
-     * as errors, they just result in a failing evaluation state.
-     *
-     * @param xpath simple XPath expression
-     * @return XPath evaluation state
-     */
-    public Matcher parse(String xpath) {
-        if (xpath.equals("/text()")) {
-            return TextMatcher.INSTANCE;
-        } else if (xpath.equals("/node()")) {
-            return NodeMatcher.INSTANCE;
-        } else if (xpath.equals("/descendant:node()")) {
-            return new CompositeMatcher(
-                    TextMatcher.INSTANCE,
-                    new ChildMatcher(new SubtreeMatcher(NodeMatcher.INSTANCE)));
-        } else if (xpath.equals("/@*")) {
-            return AttributeMatcher.INSTANCE;
-        } else if (xpath.length() == 0) {
-            return ElementMatcher.INSTANCE;
-        } else if (xpath.startsWith("/@")) {
-            String name = xpath.substring(2);
-            String prefix = null;
-            int colon = name.indexOf(':');
-            if (colon != -1) {
-                prefix = name.substring(0, colon);
-                name = name.substring(colon + 1);
-            }
-            if (prefixes.containsKey(prefix)) {
-                return new NamedAttributeMatcher(prefixes.get(prefix), name);
-            } else {
-                return Matcher.FAIL;
-            }
-        } else if (xpath.startsWith("/*")) {
-            return new ChildMatcher(parse(xpath.substring(2)));
-        } else if (xpath.startsWith("///")) {
-            return Matcher.FAIL;
-        } else if (xpath.startsWith("//")) {
-            return new SubtreeMatcher(parse(xpath.substring(1)));
-        } else if (xpath.startsWith("/")) {
-            int slash = xpath.indexOf('/', 1);
-            if (slash == -1) {
-                slash = xpath.length();
-            }
-            String name = xpath.substring(1, slash);
-            String prefix = null;
-            int colon = name.indexOf(':');
-            if (colon != -1) {
-                prefix = name.substring(0, colon);
-                name = name.substring(colon + 1);
-            }
-            if (prefixes.containsKey(prefix)) {
-                return new NamedElementMatcher(
-                        prefixes.get(prefix), name,
-                        parse(xpath.substring(slash)));
-            } else {
-                return Matcher.FAIL;
-            }
-        } else {
-            return Matcher.FAIL;
-        }
-    }
-
-}
+/*
+ * 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.sax.xpath;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Parser for a very simple XPath subset. Only the following XPath constructs
+ * (with namespaces) are supported:
+ * <ul>
+ *   <li><code>.../text()</code></li>
+ *   <li><code>.../@*</code></li>
+ *   <li><code>.../@name</code></li>
+ *   <li><code>.../*...</code></li>
+ *   <li><code>.../name...</code></li>
+ *   <li><code>...//*...</code></li>
+ *   <li><code>...//name...</code></li>
+ * </ul>
+ */
+public class XPathParser {
+
+    private final Map<String, String> prefixes = new HashMap<String, String>();
+
+    public XPathParser() {
+    }
+
+    public XPathParser(String prefix, String namespace) {
+        addPrefix(prefix, namespace);
+    }
+
+    public void addPrefix(String prefix, String namespace) {
+        prefixes.put(prefix, namespace);
+    }
+
+    /**
+     * Parses the given simple XPath expression to an evaluation state
+     * initialized at the document node. Invalid expressions are not flagged
+     * as errors, they just result in a failing evaluation state.
+     *
+     * @param xpath simple XPath expression
+     * @return XPath evaluation state
+     */
+    public Matcher parse(String xpath) {
+        if (xpath.equals("/text()")) {
+            return TextMatcher.INSTANCE;
+        } else if (xpath.equals("/node()")) {
+            return NodeMatcher.INSTANCE;
+        } else if (xpath.equals("/descendant:node()")) {
+            return new CompositeMatcher(
+                    TextMatcher.INSTANCE,
+                    new ChildMatcher(new SubtreeMatcher(NodeMatcher.INSTANCE)));
+        } else if (xpath.equals("/@*")) {
+            return AttributeMatcher.INSTANCE;
+        } else if (xpath.length() == 0) {
+            return ElementMatcher.INSTANCE;
+        } else if (xpath.startsWith("/@")) {
+            String name = xpath.substring(2);
+            String prefix = null;
+            int colon = name.indexOf(':');
+            if (colon != -1) {
+                prefix = name.substring(0, colon);
+                name = name.substring(colon + 1);
+            }
+            if (prefixes.containsKey(prefix)) {
+                return new NamedAttributeMatcher(prefixes.get(prefix), name);
+            } else {
+                return Matcher.FAIL;
+            }
+        } else if (xpath.startsWith("/*")) {
+            return new ChildMatcher(parse(xpath.substring(2)));
+        } else if (xpath.startsWith("///")) {
+            return Matcher.FAIL;
+        } else if (xpath.startsWith("//")) {
+            return new SubtreeMatcher(parse(xpath.substring(1)));
+        } else if (xpath.startsWith("/")) {
+            int slash = xpath.indexOf('/', 1);
+            if (slash == -1) {
+                slash = xpath.length();
+            }
+            String name = xpath.substring(1, slash);
+            String prefix = null;
+            int colon = name.indexOf(':');
+            if (colon != -1) {
+                prefix = name.substring(0, colon);
+                name = name.substring(colon + 1);
+            }
+            if (prefixes.containsKey(prefix)) {
+                return new NamedElementMatcher(
+                        prefixes.get(prefix), name,
+                        parse(xpath.substring(slash)));
+            } else {
+                return Matcher.FAIL;
+            }
+        } else {
+            return Matcher.FAIL;
+        }
+    }
+
+}

Propchange: lucene/tika/trunk/src/main/java/org/apache/tika/sax/xpath/XPathParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/test/java/org/apache/tika/mime/MediaTypeTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/mime/MediaTypeTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/mime/MediaTypeTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/mime/MediaTypeTest.java Sun Nov 30 15:15:09 2008
@@ -1,111 +1,111 @@
-/*
- * 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.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-public class MediaTypeTest extends TestCase {
-
-    public void testBasics() {
-        assertEquals(
-                "application/octet-stream",
-                new MediaType("application", "octet-stream").toString());
-
-        assertEquals(
-                "text/plain",
-                new MediaType("text", "plain").toString());
-
-        Map<String, String> parameters = new HashMap<String, String>();
-        assertEquals(
-                "text/plain",
-                new MediaType("text", "plain", parameters).toString());
-
-        parameters.put("charset", "UTF-8");
-        assertEquals(
-                "text/plain; charset=UTF-8",
-                new MediaType("text", "plain", parameters).toString());
-
-        parameters.put("x-eol-style", "crlf");
-        assertEquals(
-                "text/plain; charset=UTF-8; x-eol-style=crlf",
-                new MediaType("text", "plain", parameters).toString());
-    }
-
-    public void testLowerCase() {
-        assertEquals(
-                "text/plain",
-                new MediaType("TEXT", "PLAIN").toString());
-        assertEquals(
-                "text/plain",
-                new MediaType("Text", "Plain").toString());
-
-        Map<String, String> parameters = new HashMap<String, String>();
-        assertEquals(
-                "text/plain",
-                new MediaType("text", "PLAIN", parameters).toString());
-
-        parameters.put("CHARSET", "UTF-8");
-        assertEquals(
-                "text/plain; charset=UTF-8",
-                new MediaType("TEXT", "plain", parameters).toString());
-
-        parameters.put("X-Eol-Style", "crlf");
-        assertEquals(
-                "text/plain; charset=UTF-8; x-eol-style=crlf",
-                new MediaType("TeXt", "PlAiN", parameters).toString());
-    }
-
-    public void testTrim() {
-        assertEquals(
-                "text/plain",
-                new MediaType(" text ", " plain ").toString());
-        assertEquals(
-                "text/plain",
-                new MediaType("\ttext", "plain\t").toString());
-
-        Map<String, String> parameters = new HashMap<String, String>();
-        assertEquals(
-                "text/plain",
-                new MediaType("text\r\n", " \tplain", parameters).toString());
-
-        parameters.put(" charset", "UTF-8");
-        assertEquals(
-                "text/plain; charset=UTF-8",
-                new MediaType("\n\ntext", "plain \r", parameters).toString());
-
-        parameters.put("\r\n\tx-eol-style  \t", "crlf");
-        assertEquals(
-                "text/plain; charset=UTF-8; x-eol-style=crlf",
-            new MediaType("    text", "\tplain ", parameters).toString());
-    }
-
-    public void testQuote() {
-        Map<String, String> parameters = new HashMap<String, String>();
-        parameters.put("a", " value with spaces ");
-        parameters.put("b", "text/plain");
-        parameters.put("c", "()<>@,;:\\\"/[]?=");
-        assertEquals(
-                "text/plain; a=\" value with spaces \"; b=\"text\\/plain\""
-                + "; c=\"\\(\\)\\<\\>\\@\\,\\;\\:\\\\\\\"\\/\\[\\]\\?\\=\"",
-                new MediaType("text", "plain", parameters).toString());
-    }
-
-    
-}
+/*
+ * 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.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+public class MediaTypeTest extends TestCase {
+
+    public void testBasics() {
+        assertEquals(
+                "application/octet-stream",
+                new MediaType("application", "octet-stream").toString());
+
+        assertEquals(
+                "text/plain",
+                new MediaType("text", "plain").toString());
+
+        Map<String, String> parameters = new HashMap<String, String>();
+        assertEquals(
+                "text/plain",
+                new MediaType("text", "plain", parameters).toString());
+
+        parameters.put("charset", "UTF-8");
+        assertEquals(
+                "text/plain; charset=UTF-8",
+                new MediaType("text", "plain", parameters).toString());
+
+        parameters.put("x-eol-style", "crlf");
+        assertEquals(
+                "text/plain; charset=UTF-8; x-eol-style=crlf",
+                new MediaType("text", "plain", parameters).toString());
+    }
+
+    public void testLowerCase() {
+        assertEquals(
+                "text/plain",
+                new MediaType("TEXT", "PLAIN").toString());
+        assertEquals(
+                "text/plain",
+                new MediaType("Text", "Plain").toString());
+
+        Map<String, String> parameters = new HashMap<String, String>();
+        assertEquals(
+                "text/plain",
+                new MediaType("text", "PLAIN", parameters).toString());
+
+        parameters.put("CHARSET", "UTF-8");
+        assertEquals(
+                "text/plain; charset=UTF-8",
+                new MediaType("TEXT", "plain", parameters).toString());
+
+        parameters.put("X-Eol-Style", "crlf");
+        assertEquals(
+                "text/plain; charset=UTF-8; x-eol-style=crlf",
+                new MediaType("TeXt", "PlAiN", parameters).toString());
+    }
+
+    public void testTrim() {
+        assertEquals(
+                "text/plain",
+                new MediaType(" text ", " plain ").toString());
+        assertEquals(
+                "text/plain",
+                new MediaType("\ttext", "plain\t").toString());
+
+        Map<String, String> parameters = new HashMap<String, String>();
+        assertEquals(
+                "text/plain",
+                new MediaType("text\r\n", " \tplain", parameters).toString());
+
+        parameters.put(" charset", "UTF-8");
+        assertEquals(
+                "text/plain; charset=UTF-8",
+                new MediaType("\n\ntext", "plain \r", parameters).toString());
+
+        parameters.put("\r\n\tx-eol-style  \t", "crlf");
+        assertEquals(
+                "text/plain; charset=UTF-8; x-eol-style=crlf",
+            new MediaType("    text", "\tplain ", parameters).toString());
+    }
+
+    public void testQuote() {
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("a", " value with spaces ");
+        parameters.put("b", "text/plain");
+        parameters.put("c", "()<>@,;:\\\"/[]?=");
+        assertEquals(
+                "text/plain; a=\" value with spaces \"; b=\"text\\/plain\""
+                + "; c=\"\\(\\)\\<\\>\\@\\,\\;\\:\\\\\\\"\\/\\[\\]\\?\\=\"",
+                new MediaType("text", "plain", parameters).toString());
+    }
+
+    
+}

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/mime/MediaTypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java Sun Nov 30 15:15:09 2008
@@ -1,72 +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
-        }
-    }
-}
+/*
+ * 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
+        }
+    }
+}

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/mime/PatternsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/ParsingReaderTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/ParsingReaderTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/ParsingReaderTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/ParsingReaderTest.java Sun Nov 30 15:15:09 2008
@@ -1,71 +1,71 @@
-/*
- * 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;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.Reader;
-
-import junit.framework.TestCase;
-
-public class ParsingReaderTest extends TestCase {
-
-    public void testPlainText() throws Exception {
-        String data = "test content";
-        InputStream stream = new ByteArrayInputStream(data.getBytes("UTF-8"));
-        Reader reader = new ParsingReader(stream, "test.txt");
-        assertEquals('t', reader.read());
-        assertEquals('e', reader.read());
-        assertEquals('s', reader.read());
-        assertEquals('t', reader.read());
-        assertEquals(' ', reader.read());
-        assertEquals('c', reader.read());
-        assertEquals('o', reader.read());
-        assertEquals('n', reader.read());
-        assertEquals('t', reader.read());
-        assertEquals('e', reader.read());
-        assertEquals('n', reader.read());
-        assertEquals('t', reader.read());
-        assertEquals('\n', reader.read());
-        assertEquals(-1, reader.read());
-        reader.close();
-        assertEquals(-1, stream.read());
-    }
-
-    public void testXML() throws Exception {
-        String data = "<p>test <span>content</span></p>";
-        InputStream stream = new ByteArrayInputStream(data.getBytes("UTF-8"));
-        Reader reader = new ParsingReader(stream, "test.xml");
-        assertEquals('t', reader.read());
-        assertEquals('e', reader.read());
-        assertEquals('s', reader.read());
-        assertEquals('t', reader.read());
-        assertEquals(' ', reader.read());
-        assertEquals('c', reader.read());
-        assertEquals('o', reader.read());
-        assertEquals('n', reader.read());
-        assertEquals('t', reader.read());
-        assertEquals('e', reader.read());
-        assertEquals('n', reader.read());
-        assertEquals('t', reader.read());
-        assertEquals('\n', reader.read());
-        assertEquals(-1, reader.read());
-        reader.close();
-        assertEquals(-1, stream.read());
-    }
-
-}
+/*
+ * 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;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.Reader;
+
+import junit.framework.TestCase;
+
+public class ParsingReaderTest extends TestCase {
+
+    public void testPlainText() throws Exception {
+        String data = "test content";
+        InputStream stream = new ByteArrayInputStream(data.getBytes("UTF-8"));
+        Reader reader = new ParsingReader(stream, "test.txt");
+        assertEquals('t', reader.read());
+        assertEquals('e', reader.read());
+        assertEquals('s', reader.read());
+        assertEquals('t', reader.read());
+        assertEquals(' ', reader.read());
+        assertEquals('c', reader.read());
+        assertEquals('o', reader.read());
+        assertEquals('n', reader.read());
+        assertEquals('t', reader.read());
+        assertEquals('e', reader.read());
+        assertEquals('n', reader.read());
+        assertEquals('t', reader.read());
+        assertEquals('\n', reader.read());
+        assertEquals(-1, reader.read());
+        reader.close();
+        assertEquals(-1, stream.read());
+    }
+
+    public void testXML() throws Exception {
+        String data = "<p>test <span>content</span></p>";
+        InputStream stream = new ByteArrayInputStream(data.getBytes("UTF-8"));
+        Reader reader = new ParsingReader(stream, "test.xml");
+        assertEquals('t', reader.read());
+        assertEquals('e', reader.read());
+        assertEquals('s', reader.read());
+        assertEquals('t', reader.read());
+        assertEquals(' ', reader.read());
+        assertEquals('c', reader.read());
+        assertEquals('o', reader.read());
+        assertEquals('n', reader.read());
+        assertEquals('t', reader.read());
+        assertEquals('e', reader.read());
+        assertEquals('n', reader.read());
+        assertEquals('t', reader.read());
+        assertEquals('\n', reader.read());
+        assertEquals(-1, reader.read());
+        reader.close();
+        assertEquals(-1, stream.read());
+    }
+
+}

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/ParsingReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/audio/AudioParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/audio/MidiParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/image/ImageParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/image/ImageParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/image/ImageParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/image/ImageParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,87 +1,87 @@
-/*
- * 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.image;
-
-import java.io.InputStream;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.Parser;
-import org.xml.sax.helpers.DefaultHandler;
-
-import junit.framework.TestCase;
-
-public class ImageParserTest extends TestCase {
-
-    private final Parser parser = new ImageParser();
-
-    public void testBMP() throws Exception {
-        Metadata metadata = new Metadata();
-        metadata.set(Metadata.CONTENT_TYPE, "image/bmp");
-        InputStream stream =
-            getClass().getResourceAsStream("/test-documents/testBMP.bmp");
-        parser.parse(stream, new DefaultHandler(), metadata);
-
-        assertEquals("75", metadata.get("height"));
-        assertEquals("100", metadata.get("width"));
-    }
-
-    public void testGIF() throws Exception {
-        Metadata metadata = new Metadata();
-        metadata.set(Metadata.CONTENT_TYPE, "image/gif");
-        InputStream stream =
-            getClass().getResourceAsStream("/test-documents/testGIF.gif");
-        parser.parse(stream, new DefaultHandler(), metadata);
-
-        assertEquals("75", metadata.get("height"));
-        assertEquals("100", metadata.get("width"));
-    }
-
-    public void testJPEG() throws Exception {
-        Metadata metadata = new Metadata();
-        metadata.set(Metadata.CONTENT_TYPE, "image/jpeg");
-        InputStream stream =
-            getClass().getResourceAsStream("/test-documents/testJPEG.jpg");
-        parser.parse(stream, new DefaultHandler(), metadata);
-
-        assertEquals("75", metadata.get("height"));
-        assertEquals("100", metadata.get("width"));
-    }
-
-    public void testPNG() throws Exception {
-        Metadata metadata = new Metadata();
-        metadata.set(Metadata.CONTENT_TYPE, "image/png");
-        InputStream stream =
-            getClass().getResourceAsStream("/test-documents/testPNG.png");
-        parser.parse(stream, new DefaultHandler(), metadata);
-
-        assertEquals("75", metadata.get("height"));
-        assertEquals("100", metadata.get("width"));
-    }
-
-// TODO: Add TIFF support
-//    public void testTIFF() throws Exception {
-//        Metadata metadata = new Metadata();
-//        metadata.set(Metadata.CONTENT_TYPE, "image/tiff");
-//        InputStream stream =
-//            getClass().getResourceAsStream("/test-documents/testTIFF.tif");
-//        parser.parse(stream, new DefaultHandler(), metadata);
-//
-//        assertEquals("75", metadata.get("height"));
-//        assertEquals("100", metadata.get("width"));
-//    }
-
-}
+/*
+ * 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.image;
+
+import java.io.InputStream;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.Parser;
+import org.xml.sax.helpers.DefaultHandler;
+
+import junit.framework.TestCase;
+
+public class ImageParserTest extends TestCase {
+
+    private final Parser parser = new ImageParser();
+
+    public void testBMP() throws Exception {
+        Metadata metadata = new Metadata();
+        metadata.set(Metadata.CONTENT_TYPE, "image/bmp");
+        InputStream stream =
+            getClass().getResourceAsStream("/test-documents/testBMP.bmp");
+        parser.parse(stream, new DefaultHandler(), metadata);
+
+        assertEquals("75", metadata.get("height"));
+        assertEquals("100", metadata.get("width"));
+    }
+
+    public void testGIF() throws Exception {
+        Metadata metadata = new Metadata();
+        metadata.set(Metadata.CONTENT_TYPE, "image/gif");
+        InputStream stream =
+            getClass().getResourceAsStream("/test-documents/testGIF.gif");
+        parser.parse(stream, new DefaultHandler(), metadata);
+
+        assertEquals("75", metadata.get("height"));
+        assertEquals("100", metadata.get("width"));
+    }
+
+    public void testJPEG() throws Exception {
+        Metadata metadata = new Metadata();
+        metadata.set(Metadata.CONTENT_TYPE, "image/jpeg");
+        InputStream stream =
+            getClass().getResourceAsStream("/test-documents/testJPEG.jpg");
+        parser.parse(stream, new DefaultHandler(), metadata);
+
+        assertEquals("75", metadata.get("height"));
+        assertEquals("100", metadata.get("width"));
+    }
+
+    public void testPNG() throws Exception {
+        Metadata metadata = new Metadata();
+        metadata.set(Metadata.CONTENT_TYPE, "image/png");
+        InputStream stream =
+            getClass().getResourceAsStream("/test-documents/testPNG.png");
+        parser.parse(stream, new DefaultHandler(), metadata);
+
+        assertEquals("75", metadata.get("height"));
+        assertEquals("100", metadata.get("width"));
+    }
+
+// TODO: Add TIFF support
+//    public void testTIFF() throws Exception {
+//        Metadata metadata = new Metadata();
+//        metadata.set(Metadata.CONTENT_TYPE, "image/tiff");
+//        InputStream stream =
+//            getClass().getResourceAsStream("/test-documents/testTIFF.tif");
+//        parser.parse(stream, new DefaultHandler(), metadata);
+//
+//        assertEquals("75", metadata.get("height"));
+//        assertEquals("100", metadata.get("width"));
+//    }
+
+}

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/image/ImageParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/tika/trunk/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java?rev=721926&r1=721925&r2=721926&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java (original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java Sun Nov 30 15:15:09 2008
@@ -1,65 +1,65 @@
-/*
- * 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.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.AutoDetectParser;
-import org.apache.tika.parser.Parser;
-import org.apache.tika.sax.BodyContentHandler;
-import org.xml.sax.ContentHandler;
-
-/**
- * Test case for parsing Outlook files.
- */
-public class OutlookParserTest extends TestCase {
-
-    public void testOutlookParsing() throws Exception {
-        Parser parser = new AutoDetectParser(); // Should auto-detect!
-        ContentHandler handler = new BodyContentHandler();
-        Metadata metadata = new Metadata();
-
-        InputStream stream = OutlookParserTest.class.getResourceAsStream(
-                "/test-documents/test-outlook.msg");
-        try {
-            parser.parse(stream, handler, metadata);
-        } finally {
-            stream.close();
-        }
-
-        assertEquals(
-                "application/vnd.ms-outlook",
-                metadata.get(Metadata.CONTENT_TYPE));
-        assertEquals(
-                "Microsoft Outlook Express 6",
-                metadata.get(Metadata.TITLE));
-        // TODO: There's apparently some encoding issue in POI
-        //assertEquals(
-        //        "L'\u00C9quipe Microsoft Outlook Express",
-        //        metadata.get(Metadata.AUTHOR));
-
-        String content = handler.toString();
-        assertTrue(content.contains("Microsoft Outlook Express 6"));
-        //assertTrue(content.contains("L'\u00C9quipe Microsoft Outlook Express"));
-        assertTrue(content.contains("Nouvel utilisateur de Outlook Express"));
-        assertTrue(content.contains("Messagerie et groupes de discussion"));
-    }
-
-}
+/*
+ * 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.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.AutoDetectParser;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.sax.BodyContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Test case for parsing Outlook files.
+ */
+public class OutlookParserTest extends TestCase {
+
+    public void testOutlookParsing() throws Exception {
+        Parser parser = new AutoDetectParser(); // Should auto-detect!
+        ContentHandler handler = new BodyContentHandler();
+        Metadata metadata = new Metadata();
+
+        InputStream stream = OutlookParserTest.class.getResourceAsStream(
+                "/test-documents/test-outlook.msg");
+        try {
+            parser.parse(stream, handler, metadata);
+        } finally {
+            stream.close();
+        }
+
+        assertEquals(
+                "application/vnd.ms-outlook",
+                metadata.get(Metadata.CONTENT_TYPE));
+        assertEquals(
+                "Microsoft Outlook Express 6",
+                metadata.get(Metadata.TITLE));
+        // TODO: There's apparently some encoding issue in POI
+        //assertEquals(
+        //        "L'\u00C9quipe Microsoft Outlook Express",
+        //        metadata.get(Metadata.AUTHOR));
+
+        String content = handler.toString();
+        assertTrue(content.contains("Microsoft Outlook Express 6"));
+        //assertTrue(content.contains("L'\u00C9quipe Microsoft Outlook Express"));
+        assertTrue(content.contains("Nouvel utilisateur de Outlook Express"));
+        assertTrue(content.contains("Messagerie et groupes de discussion"));
+    }
+
+}

Propchange: lucene/tika/trunk/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native