jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r880743 - /jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java
Date Mon, 16 Nov 2009 13:34:56 GMT
Author: jukka
Date: Mon Nov 16 13:34:56 2009
New Revision: 880743

URL: http://svn.apache.org/viewvc?rev=880743&view=rev
Log:
JCR-2385: webdav: nullpointer exception while getting the tikka detector

The IOManager instance is not available when a DefaultHandler is used as a PropertyHandler
implementation. In such cases we can simply return application/octet-stream as the content
type.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java?rev=880743&r1=880742&r2=880743&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java
Mon Nov 16 13:34:56 2009
@@ -24,9 +24,6 @@
 import org.apache.jackrabbit.webdav.xml.Namespace;
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.tika.config.TikaConfig;
-import org.apache.tika.detect.Detector;
-import org.apache.tika.exception.TikaException;
 import org.apache.tika.metadata.Metadata;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -665,7 +662,11 @@
         try {
             Metadata metadata = new Metadata();
             metadata.set(Metadata.RESOURCE_NAME_KEY, name);
-            return ioManager.getDetector().detect(null, metadata).toString();
+            if (ioManager != null && ioManager.getDetector() != null) {
+                return ioManager.getDetector().detect(null, metadata).toString();
+            } else {
+                return "application/octet-stream";
+            }
         } catch (IOException e) {
             // Can not happen since the InputStream above is null
             throw new IllegalStateException(



Mime
View raw message