Update of /var/cvs/src/org/mmbase/util
In directory james.mmbase.org:/tmp/cvs-serv15075

Modified Files:
        Casting.java SerializableInputStream.java 
Log Message:
some details only


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util


Index: Casting.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/Casting.java,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -b -r1.129 -r1.130
--- Casting.java        20 Apr 2009 11:35:42 -0000      1.129
+++ Casting.java        21 Apr 2009 12:37:01 -0000      1.130
@@ -16,7 +16,7 @@
  *
  * @author Michiel Meeuwissen
  * @since  MMBase-1.6
- * @version $Id: Casting.java,v 1.129 2009/04/20 11:35:42 michiel Exp $
+ * @version $Id: Casting.java,v 1.130 2009/04/21 12:37:01 michiel Exp $
  */
 
 import java.util.*;
@@ -581,9 +581,12 @@
      */
     static public byte[] toByte(Object obj) {
         if (obj == null) {
+            log.debug("Converted null to empty byte array", new Exception());
             return new byte[] {};
         } else if (obj instanceof byte[]) {
-            log.debug("Already byte array " + obj);
+            if (log.isDebugEnabled()) {
+                log.debug("Already byte array " + obj + " l:" + ((byte[]) 
obj).length, new Exception());
+            }
             // was allready unmapped so return the value
             return (byte[])obj;
         } else if (obj instanceof FileItem) {
@@ -613,16 +616,8 @@
     static public InputStream toInputStream(Object obj) {
         if (obj instanceof InputStream) {
             return (InputStream) obj;
-        } else if (obj instanceof FileItem) {
-            try {
-                return ((FileItem) obj).getInputStream();
-            } catch (IOException ioe) {
-                log.error(ioe);
-                return null;
-            }
         } else {
-            byte[] bytes = toByte(obj);
-            return new ByteArrayInputStream(bytes, 0, bytes.length);
+            return toSerializableInputStream(obj);
         }
     }
     static public SerializableInputStream toSerializableInputStream(Object 
obj) {


Index: SerializableInputStream.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/SerializableInputStream.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- SerializableInputStream.java        20 Apr 2009 11:22:29 -0000      1.4
+++ SerializableInputStream.java        21 Apr 2009 12:37:01 -0000      1.5
@@ -20,7 +20,7 @@
  *
  * @since MMBase-1.9
  * @author Michiel Meeuwissen
- * @version $Id: SerializableInputStream.java,v 1.4 2009/04/20 11:22:29 
michiel Exp $
+ * @version $Id: SerializableInputStream.java,v 1.5 2009/04/21 12:37:01 
michiel Exp $
  * @todo IllegalStateException or so, if the inputstreas is used (already).
  */
 
@@ -114,6 +114,6 @@
     public long skip(long n) throws IOException { return wrapped.skip(n); }
 
     public String toString() {
-        return "SERIALIZABLE " + wrapped + (used ? " (used)" :  "");
+        return "SERIALIZABLE " + wrapped + (used ? " (used)" :  "") + "(" + 
size + " byte)";
     }
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to