Update of /var/cvs/src/org/mmbase/module/core
In directory james.mmbase.org:/tmp/cvs-serv7338

Modified Files:
        MMObjectNode.java 
Log Message:
Some test-cases are failing because 'checkSerializable'. This fixes some


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/module/core


Index: MMObjectNode.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/module/core/MMObjectNode.java,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -b -r1.230 -r1.231
--- MMObjectNode.java   7 Apr 2009 08:23:34 -0000       1.230
+++ MMObjectNode.java   14 Apr 2009 13:14:43 -0000      1.231
@@ -38,10 +38,11 @@
  * @author Eduard Witteveen
  * @author Michiel Meeuwissen
  * @author Ernst Bunders
- * @version $Id: MMObjectNode.java,v 1.230 2009/04/07 08:23:34 nklasens Exp $
+ * @version $Id: MMObjectNode.java,v 1.231 2009/04/14 13:14:43 michiel Exp $
  */
 
-public class MMObjectNode implements org.mmbase.util.SizeMeasurable, 
java.io.Serializable { // Comparable<MMObjectNode>  {
+public class MMObjectNode implements org.mmbase.util.SizeMeasurable, 
java.io.Serializable, org.mmbase.util.PublicCloneable<MMObjectNode> { // 
Comparable<MMObjectNode>  {
+
     private static final Logger log = 
Logging.getLoggerInstance(MMObjectNode.class);
 
 
@@ -448,7 +449,8 @@
         }
         if (!getBuilder().hasField(fieldName)) {
             if (MMBase.getMMBase().inDevelopment()) {
-                throw new IllegalArgumentException("You cannot use 
non-existing field '" + fieldName + "' of node '" + getNumber() + "' existing 
fields of '" + getBuilder().getTableName() + "' are " + 
getBuilder().getFieldNames());
+                throw new IllegalArgumentException("You cannot use 
non-existing field '" + fieldName + "' of node '" + getNumber() + "' existing 
fields of '" +
+                                                   getBuilder().getTableName() 
+ "' are " + getBuilder().getFieldNames());
             } else {
                 log.warn("Tried to use non-existing field '" + fieldName + "' 
of node '" + getNumber() + "' from " + getBuilder().getTableName());
                 log.warn(Logging.applicationStacktrace());
@@ -465,6 +467,11 @@
      * @since MMBase-1.9
      */
     protected final Object checkSerializable(String fieldName, Object 
fieldValue) {
+        if (fieldValue instanceof org.mmbase.util.SortedBundle.ValueWrapper) {
+            // TODO, I don't think that this is the correct spot to do this, 
but it solves some
+            // test-cases failures for now
+            fieldValue = ((org.mmbase.util.SortedBundle.ValueWrapper) 
fieldValue).getKey();
+        }
         if (fieldValue != null && (! (fieldValue instanceof Serializable))) {
             log.warn("Value for " + fieldName + " is not serializable: " + 
fieldValue.getClass() + " " + fieldValue, new Exception());
         }
@@ -1860,4 +1867,13 @@
     public int compareTo(MMObjectNode n) {
         return getNumber() - n.getNumber();
     }
+
+    public MMObjectNode clone() {
+        try {
+            return (MMObjectNode) super.clone();
+        } catch (CloneNotSupportedException cnse) {
+            log.error("Java sucks");
+            return null;
+        }
+    }
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to