Author: nbelaevski
Date: 2008-03-02 20:41:29 -0500 (Sun, 02 Mar 2008)
New Revision: 6477
Modified:
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
Log:
UITree.java: check for illegal value and diagnostic exception added
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-03-03 01:40:37
UTC (rev 6476)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-03-03 01:41:29
UTC (rev 6477)
@@ -53,6 +53,7 @@
import org.richfaces.component.state.events.ExpandAllCommandEvent;
import org.richfaces.component.state.events.ExpandNodeCommandEvent;
import org.richfaces.component.state.events.TreeStateCommandEvent;
+import org.richfaces.component.util.MessageUtil;
import org.richfaces.event.DragEvent;
import org.richfaces.event.DragListener;
import org.richfaces.event.DropEvent;
@@ -523,7 +524,7 @@
}
return treeDataModel;
- } else {
+ } else if (value instanceof javax.swing.tree.TreeNode) {
TreeDataModel<javax.swing.tree.TreeNode> swingTreeDataModel = new
SwingTreeDataModel();
swingTreeDataModel.setWrappedData(value);
@@ -532,6 +533,12 @@
}
return swingTreeDataModel;
+ } else {
+ throw new IllegalArgumentException("Value of tree component " +
+ MessageUtil.getLabel(FacesContext.getCurrentInstance(), this) +
+ "[" + value + "]" +
+ "is not an instance of neither " + TreeNode.class.getName() +
+ "nor " + javax.swing.tree.TreeNode.class.getName() + "!");
}
} else {
//TODO implement request caching
Show replies by date