Author: michiel
Date: 2010-02-15 14:03:02 +0100 (Mon, 15 Feb 2010)
New Revision: 40990

Modified:
   mmbase/trunk/core/src/main/java/org/mmbase/util/SerializableInputStream.java
Log:
added warning if content type could not be determined

Modified: 
mmbase/trunk/core/src/main/java/org/mmbase/util/SerializableInputStream.java
===================================================================
--- 
mmbase/trunk/core/src/main/java/org/mmbase/util/SerializableInputStream.java    
    2010-02-15 12:59:50 UTC (rev 40989)
+++ 
mmbase/trunk/core/src/main/java/org/mmbase/util/SerializableInputStream.java    
    2010-02-15 13:03:02 UTC (rev 40990)
@@ -95,9 +95,14 @@
         this.wrapped = new FileInputStream(tempFile);
         this.size = tempFile.length();
         this.name = name;
-        this.contentType = MagicFile.getInstance().getMimeType(tempFile);
-        if (MagicFile.FAILED.equals(this.contentType)) {
-            this.contentType = null;
+        if (tempFile.length() > 0) {
+            this.contentType = MagicFile.getInstance().getMimeType(tempFile);
+            if (MagicFile.FAILED.equals(this.contentType)) {
+                // TODO: try filename.
+
+                log.warn("Failed to determin type of " + tempFile);
+                this.contentType = null;
+            }
         }
     }
     /**
@@ -114,7 +119,9 @@
         if (array.length > 0) {
             try {
                 this.contentType = MagicFile.getInstance().getMimeType(array);
+
                 if (MagicFile.FAILED.equals(this.contentType)) {
+                    log.warn("Failed to determin type of byte array");
                     this.contentType = null;
                 }
             } catch (Exception e) {

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to