r9889 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Mon, 14 Sep 2009 21:59:33 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090914195933.02E633D0E3@mia>
Author: hannes
Date: 2009-09-14 21:59:33 +0200 (Mon, 14 Sep 2009)
New Revision: 9889

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/Node.java
Log:
Catch exceptions thrown while detaching from parent in Node.remove()

Details at http://dev.helma.org/trac/helma/changeset/9889

Modified: helma/helma/trunk/src/helma/objectmodel/db/Node.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-09-14 19:56:51 UTC (rev 9888)
+++ helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-09-14 19:59:33 UTC (rev 9889)
@@ -24,10 +24,6 @@
 import helma.objectmodel.IProperty;
 import helma.util.EmptyEnumeration;
 
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
 import java.util.*;
 
 /**
@@ -199,13 +195,6 @@
     }
 
     /**
-     * used by Xml deserialization
-     */
-    public synchronized void setSubnodes(SubnodeList subnodes) {
-        this.subnodes = subnodes;
-    }
-
-    /**
      * Get the write lock on this node, throwing a ConcurrencyException if the
      * lock is already held by another thread.
      */
@@ -810,7 +799,7 @@
         loadNodes();
 
         // check if this node has a group-by subnode-relation
-        INode groupbyNode = getGroupbySubnode(node, true);
+        Node groupbyNode = getGroupbySubnode(node, true);
         if (groupbyNode != null) {
             groupbyNode.addNode(node);
             return node;
@@ -1228,7 +1217,12 @@
     public boolean remove() {
         INode parent = getParent();
         if (parent != null) {
-            parent.removeNode(this);
+            try {
+                parent.removeNode(this);
+            } catch (Exception x) {
+                // couldn't remove from parent. Log and continue
+                getApp().logError("Couldn't remove node from parent: " + x);
+            }
         }
         deepRemoveNode();
         return true;
@@ -1480,8 +1474,7 @@
     }
 
     /**
-     * Retrieve an empty subnodelist. This empty List is an instance of the Class
-     * used for this Nodes subnode-list
+     * Create an empty subnode list.
      * @return List an empty List of the type used by this Node
      */
     public SubnodeList createSubnodeList() {
@@ -2572,31 +2565,6 @@
     }
 
     /**
-     * This method get's called from the JavaScript environment
-     * (HopObject.updateSubnodes() or HopObject.collection.updateSubnodes()))
-     * The subnode-collection will be updated with a selectstatement getting all
-     * Nodes having a higher id than the highest id currently contained within
-     * this Node's subnoderelation. If this subnodelist has a special order
-     * all nodes will be loaded honoring this order.
-     * Example:
-     *  order by somefield1 asc, somefieled2 desc
-     * gives a where-clausel like the following:
-     *   (somefiled1 > theHighestKnownValue value and somefield2 < theLowestKnownValue)
-     * @return the number of loaded nodes within this collection update
-     */
-    /* public int updateSubnodes () {
-        // TODO: what do we do if dbmap is null
-        if (dbmap == null) {
-            throw new RuntimeException (this + " doesn't have a DbMapping");
-        }
-        Relation subRel = dbmap.getSubnodeRelation();
-        synchronized (this) {
-            lastSubnodeFetch = getLastSubnodeChange(subRel);
-            return nmgr.updateSubnodeList(this, subRel);
-        }
-    } */
-
-    /**
      * Get the application this node belongs to.
      * @return the app we belong to
      */