Author: sergeyhalipov
Date: 2007-09-24 12:09:16 -0400 (Mon, 24 Sep 2007)
New Revision: 3075
Modified:
trunk/ui/toolBar/src/main/java/org/richfaces/component/UIToolBarGroup.java
Log:
http://jira.jboss.com/jira/browse/RF-970
Modified: trunk/ui/toolBar/src/main/java/org/richfaces/component/UIToolBarGroup.java
===================================================================
--- trunk/ui/toolBar/src/main/java/org/richfaces/component/UIToolBarGroup.java 2007-09-24
16:04:02 UTC (rev 3074)
+++ trunk/ui/toolBar/src/main/java/org/richfaces/component/UIToolBarGroup.java 2007-09-24
16:09:16 UTC (rev 3075)
@@ -40,14 +40,13 @@
public UIToolBar getToolBar() {
UIComponent component = this.getParent();
- while (component != null && !(component instanceof UIToolBar)) {
- component = component.getParent();
+ if (component == null) {
+ throw new FacesException("The component: " +
this.getClientId(getFacesContext()) +
+ " is not nested within " + UIToolBar.class.getSimpleName());
+ } else if (!(component instanceof UIToolBar)) {
+ throw new FacesException("The component: " +
this.getClientId(getFacesContext()) +
+ " is not a direct child of " + UIToolBar.class.getSimpleName());
}
-
- if (component == null) {
- throw new FacesException("The component: " +
this.getClientId(getFacesContext()) + " is not nested within " +
UIToolBar.class.getSimpleName());
- } else {
- return (UIToolBar) component;
- }
+ return (UIToolBar) component;
}
}