dev@javaserverfaces.java.net

[REVIEW] Corrections that allow ManagedBeanELResolver.getFeatureDescriptors() to pass the TCK

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 10 Jun 2005 15:52:36 -0400

SECTION: Modified Files
----------------------------
M jsf-ri/src/com/sun/faces/config/ManagedBeanFactory.java
  - modified getDescription() to return the description if found
  - modified getManagedBeanClass() to use the parsed managed
    bean class vs the managed bean name
 
M jsf-ri/src/com/sun/faces/el/ManagedBeanELResolver.java
  - handle the case where description element doesn't include a lang
    or xml:lang attribute
  - pass the result of getManagedBeanClass() instead of calling get
    class on the MangedBeanFactory



SECTION: Diffs
----------------------------
Index: jsf-ri/src/com/sun/faces/config/ManagedBeanFactory.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/config/ManagedBeanFactory.java,v
retrieving revision 1.29
diff -u -r1.29 ManagedBeanFactory.java
--- jsf-ri/src/com/sun/faces/config/ManagedBeanFactory.java 16 May
2005 20:16:16 -0000 1.29
+++ jsf-ri/src/com/sun/faces/config/ManagedBeanFactory.java 10 Jun
2005 19:47:58 -0000
@@ -168,7 +168,7 @@
     public String getBeanDescription(String lang) {
         DescriptionBean db = managedBean.getDescription(lang);
         if (db != null) {
- db.getDescription();
+ return db.getDescription();
         }
         return null;
     }
@@ -179,7 +179,7 @@
             if (loader == null) {
                 loader = this.getClass().getClassLoader();
             }
- return loader.loadClass(managedBean.getManagedBeanName());
+ return loader.loadClass(managedBean.getManagedBeanClass());
         } catch (Exception e) {
         }
         return null;

Index: jsf-ri/src/com/sun/faces/el/ManagedBeanELResolver.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/ManagedBeanELResolver.java,v
retrieving revision 1.2
diff -u -r1.2 ManagedBeanELResolver.java
--- jsf-ri/src/com/sun/faces/el/ManagedBeanELResolver.java 16 May
2005 20:16:19 -0000 1.2
+++ jsf-ri/src/com/sun/faces/el/ManagedBeanELResolver.java 10 Jun
2005 19:47:58 -0000
@@ -8,11 +8,9 @@
 
 package com.sun.faces.el;
 
-import java.beans.BeanInfo;
-import java.beans.FeatureDescriptor;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
+import com.sun.faces.application.ApplicationAssociate;
+import com.sun.faces.config.ManagedBeanFactory;
+import com.sun.faces.util.Util;
 
 import javax.el.ELContext;
 import javax.el.ELException;
@@ -20,10 +18,11 @@
 import javax.el.PropertyNotFoundException;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
-
-import com.sun.faces.application.ApplicationAssociate;
-import com.sun.faces.config.ManagedBeanFactory;
-import com.sun.faces.util.Util;
+import java.beans.BeanInfo;
+import java.beans.FeatureDescriptor;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
 
 public class ManagedBeanELResolver extends ELResolver {
 
@@ -146,6 +145,7 @@
         if (base != null) {
             return null;
         }
+
         ArrayList list = new ArrayList();
         BeanInfo info = null;
        
@@ -167,9 +167,14 @@
                 String desc =
                 managedBean.getBeanDescription((
                     facesContext.getViewRoot().getLocale()).toString());
+ if (desc == null) {
+ // handle the case where the lang or xml:lang
attributes
+ // are not specified on the description
+ desc = managedBean.getBeanDescription("");
+ }
                 list.add(getFeatureDescriptor(managedBeanName,
                     managedBeanName, desc,false, false, true,
- managedBean.getClass(), Boolean.TRUE));
+ managedBean.getManagedBeanClass(), Boolean.TRUE));
             }
         }
         return list.iterator();
;
 
 
 /**