You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/08/09 09:58:13 UTC

svn commit: r1155246 - in /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago: internal/component/AbstractUITreeNode.java model/TreePath.java

Author: lofwyr
Date: Tue Aug  9 07:58:13 2011
New Revision: 1155246

URL: http://svn.apache.org/viewvc?rev=1155246&view=rev
Log:
TOBAGO-377: Make a little bit more robust

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java?rev=1155246&r1=1155245&r2=1155246&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java Tue Aug  9 07:58:13 2011
@@ -202,7 +202,13 @@ public abstract class AbstractUITreeNode
       boolean expanded = ((TreeExpansionEvent) event).isNewExpanded();
 
       if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.EXPANDED)) {
-        FacesUtils.setValueOfBindingOrExpression(getFacesContext(), expanded, this, Attributes.EXPANDED);
+        try {
+          FacesUtils.setValueOfBindingOrExpression(getFacesContext(), expanded, this, Attributes.EXPANDED);
+        } catch (Exception e) {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Can't set expanded.", e);
+          }
+        }
       } else {
         setExpanded(expanded);
       }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java?rev=1155246&r1=1155245&r2=1155246&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java Tue Aug  9 07:58:13 2011
@@ -82,8 +82,14 @@ public class TreePath implements Seriali
    * @return The node applied to the given path.
    */
   public DefaultMutableTreeNode getNode(DefaultMutableTreeNode tree) {
+    if (tree == null) {
+      return null;
+    }
     for (int i = 1; i < path.length; i++) { // i = 1: first entry must be 0 and means the root
       int pos = path[i];
+      if (pos >= tree.getChildCount()) {
+        return null;
+      }
       tree = (DefaultMutableTreeNode) tree.getChildAt(pos);
     }
     return tree;