myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bara...@apache.org
Subject svn commit: r413948 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/NavigationMenuUtils.java
Date Tue, 13 Jun 2006 19:02:31 GMT
Author: baranda
Date: Tue Jun 13 12:02:30 2006
New Revision: 413948

URL: http://svn.apache.org/viewvc?rev=413948&view=rev
Log:
Added null check

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/NavigationMenuUtils.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/NavigationMenuUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/NavigationMenuUtils.java?rev=413948&r1=413947&r2=413948&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/NavigationMenuUtils.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/NavigationMenuUtils.java
Tue Jun 13 12:02:30 2006
@@ -15,15 +15,18 @@
  */
 package org.apache.myfaces.custom.navmenu;
 
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.component.UserRoleUtils;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectItems;
 import javax.faces.context.FacesContext;
 import javax.faces.el.MethodBinding;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * @author Thomas Spiegl (latest modification by $Author$)
@@ -112,7 +115,14 @@
 
     public static void addNavigationMenuItems(UISelectItems child, List list)
     {
-        Object value = ((UISelectItems)child).getValue();
+        Object value = child.getValue();
+
+        if (value == null)
+        {
+            FacesContext facesContext = FacesContext.getCurrentInstance();
+            throw new NullPointerException("Value binding of UINavigationMenuItems with id
" + child.getClientId(facesContext) + " is null");
+        }
+
         if (value instanceof NavigationMenuItem)
         {
             list.add(value);



Mime
View raw message