myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sless...@apache.org
Subject svn commit: r698799 [4/4] - in /myfaces/core/branches/2_0_0: api/src/main/java/javax/faces/ api/src/main/java/javax/faces/application/ api/src/test/java/javax/faces/application/ impl/src/main/java/org/apache/myfaces/application/ impl/src/main/java/org/...
Date Thu, 25 Sep 2008 02:03:49 GMT
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/PhaseListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/PhaseListenerTag.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/PhaseListenerTag.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/PhaseListenerTag.java
Wed Sep 24 19:03:47 2008
@@ -44,13 +44,9 @@
  * @author martin.haimberger
  * @version $Revision: 462929 $ $Date: 2006-10-11 21:26:36 +0100 (mi�, 11 oct 2006)
$
  */
-@JSFJspTag(
-        name="f:phaseListener",
-        bodyContent="empty")
-public class PhaseListenerTag extends TagSupport {
-
-    private final Log log = LogFactory.getLog(PhaseListenerTag.class);
-
+@JSFJspTag(name = "f:phaseListener", bodyContent = "empty")
+public class PhaseListenerTag extends TagSupport
+{
     /**
      * The fully qualified class name of the PhaseListener which should be created.
      */
@@ -60,48 +56,50 @@
      * A value binding expression used to create a PhaseListener instance.
      */
     private ValueExpression binding = null;
-    
+
     /**
      * Class name of the PhaseListener to be created and registered.
      */
-    @JSFJspAttribute(
-            rtexprvalue=true,
-            className="java.lang.String")
-    public void setType(ValueExpression type) {
+    @JSFJspAttribute(rtexprvalue = true, className = "java.lang.String")
+    public void setType(ValueExpression type)
+    {
         this.type = type;
     }
 
     /**
      * Value binding expression that evaluates to a PhaseListener.
      */
-    @JSFJspAttribute(
-            className="javax.faces.event.PhaseListener",
-            rtexprvalue=true)
-    public void setBinding(ValueExpression binding) {
+    @JSFJspAttribute(className = "javax.faces.event.PhaseListener", rtexprvalue = true)
+    public void setBinding(ValueExpression binding)
+    {
         this.binding = binding;
     }
 
-
-    public int doStartTag() throws JspException {
+    public int doStartTag() throws JspException
+    {
 
         // JSF-Spec 1.2 9.4.9
-        //    Locate the one and only UIViewRoot custom action instance by walking up the
tag tree
-        //    until you find a UIComponentELTag instance that has no parent. If the
-        //    getCreated() method of this instance returns true, check the binding attribute.
+        // Locate the one and only UIViewRoot custom action instance by walking up the tag
tree
+        // until you find a UIComponentELTag instance that has no parent. If the
+        // getCreated() method of this instance returns true, check the binding attribute.
 
         Tag parent = this;
         UIComponentELTag parentTag = null;
-        while ((parent = parent.getParent()) != null) {
-            if (parent instanceof UIComponentELTag) {
+        while ((parent = parent.getParent()) != null)
+        {
+            if (parent instanceof UIComponentELTag)
+            {
                 parentTag = (UIComponentELTag) parent;
             }
         }
 
-        if (parentTag == null) {
+        if (parentTag == null)
+        {
             throw new JspException("Not nested in a UIViewRoot Error for tag with handler
class: " + this.getClass().getName());
         }
 
-        if (!parentTag.getCreated()) {
+        if (!parentTag.getCreated())
+        {
             return SKIP_BODY;
         }
 
@@ -121,10 +119,13 @@
         // exception as a JspException.
 
         PhaseListener listener = null;
-        try {
+        try
+        {
             listener = new BindingPhaseListener(binding, type);
-        } catch(Exception ex) {
-            throw new JspException(ex.getMessage(),ex);
+        }
+        catch (Exception ex)
+        {
+            throw new JspException(ex.getMessage(), ex);
         }
 
         root.addPhaseListener(listener);
@@ -133,36 +134,43 @@
 
     }
 
-    private static class BindingPhaseListener
-            implements PhaseListener, Serializable {
+    private static class BindingPhaseListener implements PhaseListener, Serializable
+    {
 
         private transient PhaseListener phaseListenerCache = null;
         private ValueExpression type;
         private ValueExpression binding;
         private final Log log = LogFactory.getLog(PhaseListenerTag.class);
 
-        BindingPhaseListener(ValueExpression binding, ValueExpression type) {
+        BindingPhaseListener(ValueExpression binding, ValueExpression type)
+        {
             this.binding = binding;
             this.type = type;
         }
 
-        public void afterPhase(PhaseEvent event) {
+        public void afterPhase(PhaseEvent event)
+        {
             PhaseListener listener = getPhaseListener();
-            if (listener != null) {
+            if (listener != null)
+            {
                 listener.afterPhase(event);
             }
         }
 
-        public void beforePhase(PhaseEvent event) {
+        public void beforePhase(PhaseEvent event)
+        {
             PhaseListener listener = getPhaseListener();
-            if (listener != null) {
+            if (listener != null)
+            {
                 listener.beforePhase(event);
             }
         }
 
-        public PhaseId getPhaseId() {
+        public PhaseId getPhaseId()
+        {
             PhaseListener listener = getPhaseListener();
-            if (listener != null) {
+            if (listener != null)
+            {
                 return listener.getPhaseId();
             }
 
@@ -170,15 +178,20 @@
 
         }
 
-        private PhaseListener getPhaseListener() {
+        private PhaseListener getPhaseListener()
+        {
 
-            if (phaseListenerCache != null) {
+            if (phaseListenerCache != null)
+            {
                 return phaseListenerCache;
-            } else {
+            }
+            else
+            {
                 // create PhaseListenerInstance
                 phaseListenerCache = getPhaseListnerInstance(binding, type);
             }
-            if (phaseListenerCache == null) {
+            if (phaseListenerCache == null)
+            {
                 log.warn("PhaseListener will not be installed. Both binding and type are
null.");
 
             }
@@ -187,16 +200,22 @@
 
         }
 
-        private PhaseListener getPhaseListnerInstance(ValueExpression binding,
-                                                      ValueExpression type) {
+        private PhaseListener getPhaseListnerInstance(ValueExpression binding, ValueExpression
type)
+        {
             FacesContext currentFacesContext = FacesContext.getCurrentInstance();
             Object phasesInstance = null;
-            if (binding != null) {
+            if (binding != null)
+            {
                 phasesInstance = binding.getValue(currentFacesContext.getELContext());
-            } else if (type != null) {
-                try {
-                    phasesInstance = ClassUtils.newInstance((String)type.getValue(currentFacesContext.getELContext()));
-                } catch (FacesException ex) {
+            }
+            else if (type != null)
+            {
+                try
+                {
+                    phasesInstance = ClassUtils.newInstance((String) type.getValue(currentFacesContext.getELContext()));
+                }
+                catch (FacesException ex)
+                {
                     throw new AbortProcessingException(ex.getMessage(), ex);
                 }
             }

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/SubviewTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/SubviewTag.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/SubviewTag.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/SubviewTag.java
Wed Sep 24 19:03:47 2008
@@ -18,14 +18,13 @@
  */
 package org.apache.myfaces.taglib.core;
 
-import javax.faces.webapp.UIComponentELTag;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UINamingContainer;
 import javax.faces.component.UIOutput;
 import javax.faces.context.FacesContext;
+import javax.faces.webapp.UIComponentELTag;
 
 import org.apache.myfaces.application.jsp.ViewResponseWrapper;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspTag;
 
 /**
  * @author Thomas Spiegl (latest modification by $Author$)
@@ -33,10 +32,11 @@
  */
 public class SubviewTag extends UIComponentELTag
 {
-    public SubviewTag() {
+    public SubviewTag()
+    {
         super();
     }
-    
+
     public String getComponentType()
     {
         return UINamingContainer.COMPONENT_TYPE;
@@ -46,17 +46,17 @@
     {
         return null;
     }
-    
+
     /**
-     * Creates a UIComponent from the BodyContent
-     * If a Subview is included via the <jsp:include> tag
-     * the corresponding jsp is rendered with
-     * getServletContext().getRequestDispatcher("includedSite").include(request,response)
-     * and it is possible that something was written to the Response direct.
-     * So is is necessary that the content of the wrapped response is added to the componenttree.
+     * Creates a UIComponent from the BodyContent If a Subview is included via the <jsp:include>
tag the corresponding
+     * jsp is rendered with getServletContext().getRequestDispatcher("includedSite").include(request,response)
and it is
+     * possible that something was written to the Response direct. So is is necessary that
the content of the wrapped
+     * response is added to the componenttree.
+     * 
      * @return UIComponent or null
      */
-    protected UIComponent createVerbatimComponentFromBodyContent() {
+    protected UIComponent createVerbatimComponentFromBodyContent()
+    {
         UIOutput component = (UIOutput) super.createVerbatimComponentFromBodyContent();
         FacesContext facesContext = FacesContext.getCurrentInstance();
         Object response = facesContext.getExternalContext().getResponse();
@@ -71,8 +71,8 @@
                 String componentvalue = null;
                 if (component != null)
                 {
-                    //save the Value of the Bodycontent
-                  componentvalue = (String) component.getValue();
+                    // save the Value of the Bodycontent
+                    componentvalue = (String) component.getValue();
                 }
                 component = super.createVerbatimComponent();
                 if (componentvalue != null)
@@ -87,6 +87,6 @@
             }
         }
         return component;
-    }    
-    
+    }
+
 }

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/ValueChangeListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/ValueChangeListenerTag.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/ValueChangeListenerTag.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/taglib/core/ValueChangeListenerTag.java
Wed Sep 24 19:03:47 2008
@@ -20,34 +20,29 @@
 
 import javax.el.ValueExpression;
 import javax.faces.component.EditableValueHolder;
-import javax.faces.event.ActionListener;
 import javax.faces.event.ValueChangeListener;
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspTag;
 
 /**
- * Adds the specified ValueChangeListener to the nearest parent UIComponent 
- * (which is expected to be a UIInput component).
+ * Adds the specified ValueChangeListener to the nearest parent UIComponent (which is expected
to be a UIInput
+ * component).
  * <p>
- * Whenever the form containing the parent UIComponent is submitted,
- * an instance of the specified type is created. If the submitted
- * value from the component is different from the component's current
- * value then a ValueChangeEvent is queued. When the ValueChangeEvent
- * is processed (at end of the validate phase for non-immediate components,
- * or at end of the apply-request-values phase for immediate components)
- * the object's processValueChange method is invoked.
+ * Whenever the form containing the parent UIComponent is submitted, an instance of the specified
type is created. If
+ * the submitted value from the component is different from the component's current value
then a ValueChangeEvent is
+ * queued. When the ValueChangeEvent is processed (at end of the validate phase for non-immediate
components, or at end
+ * of the apply-request-values phase for immediate components) the object's processValueChange
method is invoked.
  * </p>
  * <p>
- * Unless otherwise specified, all attributes accept static values
- * or EL expressions.
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
  * </p>
+ * 
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-@JSFJspTag(name="f:valueChangeListener",bodyContent="empty")
-public class ValueChangeListenerTag
-        extends GenericListenerTag<EditableValueHolder, ValueChangeListener>
+@JSFJspTag(name = "f:valueChangeListener", bodyContent = "empty")
+public class ValueChangeListenerTag extends GenericListenerTag<EditableValueHolder, ValueChangeListener>
 {
     private static final long serialVersionUID = 2155190261951046892L;
 
@@ -60,33 +55,28 @@
     {
         editableValueHolder.addValueChangeListener(valueChangeListener);
     }
-    
-    protected ValueChangeListener createDelegateListener(ValueExpression type,
-            ValueExpression binding)
+
+    protected ValueChangeListener createDelegateListener(ValueExpression type, ValueExpression
binding)
     {
-        return new DelegateValueChangeListener(type,binding);
+        return new DelegateValueChangeListener(type, binding);
     }
 
     /**
      * The name of a Java class that implements ValueChangeListener.
      */
-    @JSFJspAttribute(
-            className="java.lang.String",
-            rtexprvalue=true)
+    @JSFJspAttribute(className = "java.lang.String", rtexprvalue = true)
     public void setType(ValueExpression type)
     {
         super.setType(type);
     }
 
     /**
-     * Value binding expression that evaluates to an implementation of
-     * the javax.faces.event.ValueChangeListener interface.
+     * Value binding expression that evaluates to an implementation of the javax.faces.event.ValueChangeListener
+     * interface.
      */
-    @JSFJspAttribute(
-            className="javax.faces.event.ValueChangeListener",
-            rtexprvalue=true)
+    @JSFJspAttribute(className = "javax.faces.event.ValueChangeListener", rtexprvalue = true)
     public void setBinding(ValueExpression binding)
     {
         super.setBinding(binding);
-    }    
+    }
 }

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/AbstractAttributeMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/AbstractAttributeMap.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/AbstractAttributeMap.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/AbstractAttributeMap.java
Wed Sep 24 19:03:47 2008
@@ -49,8 +49,9 @@
             names.add(e.nextElement());
         }
 
-        for (String name : names) {
-          removeAttribute(name);
+        for (String name : names)
+        {
+            removeAttribute(name);
         }
     }
 
@@ -108,9 +109,10 @@
 
     public void putAll(final Map<? extends String, ? extends V> t)
     {
-      for (final Entry<? extends String, ? extends V> entry : t.entrySet()) {
-        setAttribute(entry.getKey(), entry.getValue());
-      }
+        for (final Entry<? extends String, ? extends V> entry : t.entrySet())
+        {
+            setAttribute(entry.getKey(), entry.getValue());
+        }
     }
 
     @Override
@@ -126,7 +128,7 @@
     public int size()
     {
         int size = 0;
-        for (final Enumeration e = getAttributeNames(); e.hasMoreElements();)
+        for (final Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
         {
             size++;
             e.nextElement();
@@ -246,7 +248,7 @@
                 return false;
             }
 
-            for (final Iterator it = iterator(); it.hasNext();)
+            for (final Iterator<V> it = iterator(); it.hasNext();)
             {
                 if (o.equals(it.next()))
                 {
@@ -265,7 +267,7 @@
                 return false;
             }
 
-            for (final Iterator it = iterator(); it.hasNext();)
+            for (final Iterator<V> it = iterator(); it.hasNext();)
             {
                 if (o.equals(it.next()))
                 {
@@ -295,6 +297,7 @@
             return new EntryIterator();
         }
 
+        @SuppressWarnings("unchecked")
         @Override
         public boolean contains(final Object o)
         {
@@ -303,7 +306,7 @@
                 return false;
             }
 
-            final Entry entry = (Entry) o;
+            final Entry<String, V> entry = (Entry<String, V>) o;
             final Object key = entry.getKey();
             final Object value = entry.getValue();
             if (key == null || value == null)
@@ -314,6 +317,7 @@
             return value.equals(AbstractAttributeMap.this.get(key));
         }
 
+        @SuppressWarnings("unchecked")
         @Override
         public boolean remove(final Object o)
         {
@@ -322,7 +326,7 @@
                 return false;
             }
 
-            final Entry entry = (Entry) o;
+            final Entry<String, V> entry = (Entry<String, V>) o;
             final Object key = entry.getKey();
             final Object value = entry.getValue();
             if (key == null || value == null || !value.equals(AbstractAttributeMap.this.get(key)))
@@ -330,7 +334,7 @@
                 return false;
             }
 
-            return AbstractAttributeMap.this.remove(((Entry) o).getKey()) != null;
+            return AbstractAttributeMap.this.remove(((Entry<String, V>) o).getKey())
!= null;
         }
     }
 

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
Wed Sep 24 19:03:47 2008
@@ -18,16 +18,6 @@
  */
 package org.apache.myfaces.util;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.faces.FacesException;
-import javax.faces.component.*;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.FacesListener;
-import javax.faces.validator.Validator;
 import java.beans.BeanInfo;
 import java.beans.IntrospectionException;
 import java.beans.Introspector;
@@ -36,13 +26,26 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 
+import javax.faces.FacesException;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.FacesListener;
+import javax.faces.validator.Validator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Utilities for logging.
- *
+ * 
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
@@ -50,7 +53,7 @@
 {
     private static final Log log = LogFactory.getLog(DebugUtils.class);
 
-    //Attributes that should not be printed
+    // Attributes that should not be printed
     private static final HashSet<String> IGNORE_ATTRIBUTES;
     static
     {
@@ -74,14 +77,12 @@
     private static final String JSF_COMPONENT_PACKAGE = "javax.faces.component.";
     private static final String MYFACES_COMPONENT_PACKAGE = "org.apache.myfaces.component.";
 
-
     private DebugUtils()
     {
         // hide from public access
     }
 
-    public static void assertError(boolean condition, Log log_, String msg)
-            throws FacesException
+    public static void assertError(boolean condition, Log log_, String msg) throws FacesException
     {
         if (!condition)
         {
@@ -90,8 +91,7 @@
         }
     }
 
-    public static void assertFatal(boolean condition, Log log_, String msg)
-        throws FacesException
+    public static void assertFatal(boolean condition, Log log_, String msg) throws FacesException
     {
         if (!condition)
         {
@@ -100,8 +100,6 @@
         }
     }
 
-
-
     public static void traceView(String additionalMsg)
     {
         if (log.isTraceEnabled())
@@ -124,9 +122,9 @@
     }
 
     /**
-     * Be careful, when using this version of traceView:
-     * Some component properties (e.g. getRenderer) assume, that there is a
-     * valid viewRoot set in the FacesContext!
+     * Be careful, when using this version of traceView: Some component properties (e.g.
getRenderer) assume, that there
+     * is a valid viewRoot set in the FacesContext!
+     * 
      * @param additionalMsg
      * @param viewRoot
      */
@@ -155,10 +153,7 @@
         printComponent(comp, stream, 0, false, null);
     }
 
-    private static void printComponent(UIComponent comp,
-                                       PrintStream stream,
-                                       int indent,
-                                       boolean withChildrenAndFacets,
+    private static void printComponent(UIComponent comp, PrintStream stream, int indent,
boolean withChildrenAndFacets,
                                        String facetName)
     {
         printIndent(stream, indent);
@@ -182,18 +177,17 @@
             printAttribute(stream, "facetName", facetName);
         }
 
-        for (Iterator it = comp.getAttributes().entrySet().iterator(); it.hasNext(); )
+        for (Map.Entry<String, Object> entry : comp.getAttributes().entrySet())
         {
-            Map.Entry entry = (Map.Entry)it.next();
             if (!"id".equals(entry.getKey()))
             {
-                printAttribute(stream, (String)entry.getKey(), entry.getValue());
+                printAttribute(stream, (String) entry.getKey(), entry.getValue());
             }
         }
 
-        //HACK: comp.getAttributes() only returns attributes, that are NOT backed
-        //by a corresponding component property. So, we must explicitly get the
-        //available properties by Introspection:
+        // HACK: comp.getAttributes() only returns attributes, that are NOT backed
+        // by a corresponding component property. So, we must explicitly get the
+        // available properties by Introspection:
         BeanInfo beanInfo;
         try
         {
@@ -221,7 +215,7 @@
                     {
                         if (name.equals("value") && comp instanceof ValueHolder)
                         {
-                            //-> localValue
+                            // -> localValue
                         }
                         else if (!IGNORE_ATTRIBUTES.contains(name))
                         {
@@ -246,11 +240,12 @@
 
         if (comp instanceof UICommand)
         {
-            FacesListener[] listeners = ((UICommand)comp).getActionListeners();
+            FacesListener[] listeners = ((UICommand) comp).getActionListeners();
             if (listeners != null && listeners.length > 0)
             {
                 nestedObjects = true;
-                stream.println('>'); mustClose = false;
+                stream.println('>');
+                mustClose = false;
                 for (int i = 0; i < listeners.length; i++)
                 {
                     FacesListener listener = listeners[i];
@@ -264,11 +259,12 @@
 
         if (comp instanceof UIInput)
         {
-            FacesListener[] listeners = ((UIInput)comp).getValueChangeListeners();
+            FacesListener[] listeners = ((UIInput) comp).getValueChangeListeners();
             if (listeners != null && listeners.length > 0)
             {
                 nestedObjects = true;
-                stream.println('>'); mustClose = false;
+                stream.println('>');
+                mustClose = false;
                 for (int i = 0; i < listeners.length; i++)
                 {
                     FacesListener listener = listeners[i];
@@ -279,11 +275,12 @@
                 }
             }
 
-            Validator[] validators = ((UIInput)comp).getValidators();
+            Validator[] validators = ((UIInput) comp).getValidators();
             if (validators != null && validators.length > 0)
             {
                 nestedObjects = true;
-                stream.println('>'); mustClose = false;
+                stream.println('>');
+                mustClose = false;
                 for (int i = 0; i < validators.length; i++)
                 {
                     Validator validator = validators[i];
@@ -310,19 +307,15 @@
 
                 if (childCount > 0)
                 {
-                    for (Iterator it = comp.getChildren().iterator(); it.hasNext(); )
+                    for (UIComponent child : comp.getChildren())
                     {
-                        UIComponent child = (UIComponent)it.next();
                         printComponent(child, stream, indent + 1, true, null);
                     }
                 }
 
-                for (Iterator it = facetsMap.entrySet().iterator(); it.hasNext(); )
+                for (Map.Entry<String, UIComponent> entry : facetsMap.entrySet())
                 {
-                    Map.Entry entry = (Map.Entry)it.next();
-                    printComponent((UIComponent)entry.getValue(),
-                                   stream, indent + 1, true,
-                                   (String)entry.getKey());
+                    printComponent((UIComponent) entry.getValue(), stream, indent + 1, true,
(String) entry.getKey());
                 }
             }
         }
@@ -347,11 +340,10 @@
         }
     }
 
-    private static void printAttribute(PrintStream stream,
-                                       String name,
-                                       Object value)
+    private static void printAttribute(PrintStream stream, String name, Object value)
     {
-        if (IGNORE_ATTRIBUTES.contains(name)) return;
+        if (IGNORE_ATTRIBUTES.contains(name))
+            return;
         if (name.startsWith("javax.faces.webapp.UIComponentTag."))
         {
             name = name.substring("javax.faces.webapp.UIComponentTag.".length());
@@ -364,12 +356,12 @@
             if (value instanceof UIComponent)
             {
                 stream.print("[id:");
-                stream.print(((UIComponent)value).getId());
+                stream.print(((UIComponent) value).getId());
                 stream.print(']');
             }
             else if (value instanceof MethodBinding)
             {
-                stream.print(((MethodBinding)value).getExpressionString());
+                stream.print(((MethodBinding) value).getExpressionString());
             }
             else
             {
@@ -383,7 +375,6 @@
         stream.print('"');
     }
 
-
     private static void printIndent(PrintStream stream, int depth)
     {
         for (int i = 0; i < depth; i++)

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/EnumerationIterator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/EnumerationIterator.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/EnumerationIterator.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/EnumerationIterator.java
Wed Sep 24 19:03:47 2008
@@ -25,14 +25,13 @@
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public final class EnumerationIterator
-        implements Iterator
+public final class EnumerationIterator<T> implements Iterator<T>
 {
     //private static final Log log = LogFactory.getLog(EnumerationIterator.class);
 
-    private final Enumeration _enumeration;
+    private final Enumeration<? extends T> _enumeration;
 
-    public EnumerationIterator(final Enumeration enumeration)
+    public EnumerationIterator(final Enumeration<? extends T> enumeration)
     {
         _enumeration = enumeration;
     }
@@ -42,7 +41,7 @@
         return _enumeration.hasMoreElements();
     }
 
-    public Object next()
+    public T next()
     {
         return _enumeration.nextElement();
     }

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/IteratorEnumeration.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/IteratorEnumeration.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/IteratorEnumeration.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/util/IteratorEnumeration.java
Wed Sep 24 19:03:47 2008
@@ -26,11 +26,11 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class IteratorEnumeration implements Enumeration
+public class IteratorEnumeration<T> implements Enumeration<T>
 {
-    Iterator _it;
+    Iterator<? extends T> _it;
 
-    public IteratorEnumeration(Iterator it)
+    public IteratorEnumeration(Iterator<? extends T> it)
     {
         _it = it;
     }
@@ -40,7 +40,7 @@
         return _it.hasNext();
     }
 
-    public Object nextElement()
+    public T nextElement()
     {
         return _it.next();
     }

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesHttpSessionListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesHttpSessionListener.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesHttpSessionListener.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesHttpSessionListener.java
Wed Sep 24 19:03:47 2008
@@ -35,6 +35,7 @@
     public void sessionCreated(HttpSessionEvent event) { // noop
     }
 
+    @SuppressWarnings("unchecked")
     public void sessionDestroyed(HttpSessionEvent event) {
         
         HttpSession session = event.getSession();

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServletRequestListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServletRequestListener.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServletRequestListener.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServletRequestListener.java
Wed Sep 24 19:03:47 2008
@@ -30,23 +30,26 @@
  * @author Dennis Byrne
  */
 
-public class MyFacesServletRequestListener extends AbstractMyFacesListener implements ServletRequestListener
{
-
-    public void requestDestroyed(ServletRequestEvent event) {
+public class MyFacesServletRequestListener extends AbstractMyFacesListener implements ServletRequestListener
+{
 
+    @SuppressWarnings("unchecked")
+    public void requestDestroyed(ServletRequestEvent event)
+    {
         ServletRequest request = event.getServletRequest();
         Enumeration<String> attributes = request.getAttributeNames();
-        
-        while(attributes.hasMoreElements()) 
+
+        while (attributes.hasMoreElements())
         {
             String name = attributes.nextElement();
             Object attribute = request.getAttribute(name);
             doPreDestroy(attribute, name, ManagedBeanBuilder.REQUEST);
         }
-        
+
     }
-        
-    public void requestInitialized(ServletRequestEvent event) { // noop
+
+    public void requestInitialized(ServletRequestEvent event)
+    { // noop
     }
 
 }

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java
Wed Sep 24 19:03:47 2008
@@ -33,23 +33,19 @@
 /**
  * Initialise the MyFaces system.
  * <p>
- * This context listener is registered by the JSP TLD file for the standard
- * JSF "f" components. Normally, servlet containers will automatically load
- * and process .tld files at startup time, and therefore register and run
- * this class automatically.
+ * This context listener is registered by the JSP TLD file for the standard JSF "f" components.
Normally, servlet
+ * containers will automatically load and process .tld files at startup time, and therefore
register and run this class
+ * automatically.
  * <p>
- * Some very old servlet containers do not do this correctly, so in those
- * cases this listener may be registered manually in web.xml. Registering
- * it twice (ie in both .tld and web.xml) will result in a harmless warning
- * message being generated. Very old versions of MyFaces Core do not register
- * the listener in the .tld file, so those also need a manual entry in web.xml.
- * However all versions since at least 1.1.2 have this entry in the tld.
+ * Some very old servlet containers do not do this correctly, so in those cases this listener
may be registered manually
+ * in web.xml. Registering it twice (ie in both .tld and web.xml) will result in a harmless
warning message being
+ * generated. Very old versions of MyFaces Core do not register the listener in the .tld
file, so those also need a
+ * manual entry in web.xml. However all versions since at least 1.1.2 have this entry in
the tld.
  * 
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class StartupServletContextListener extends AbstractMyFacesListener
-    implements ServletContextListener
+public class StartupServletContextListener extends AbstractMyFacesListener implements ServletContextListener
 {
     static final String FACES_INIT_DONE = StartupServletContextListener.class.getName() +
".FACES_INIT_DONE";
 
@@ -82,16 +78,16 @@
     {
         if (_facesInitializer == null)
         {
-            if (ContainerUtils.isJsp21()) 
+            if (ContainerUtils.isJsp21())
             {
                 _facesInitializer = new Jsp21FacesInitializer();
-            } 
-            else 
+            }
+            else
             {
                 _facesInitializer = new Jsp20FacesInitializer();
             }
         }
-        
+
         return _facesInitializer;
     }
 
@@ -116,7 +112,7 @@
     public void contextDestroyed(ServletContextEvent event)
     {
         doPredestroy(event);
-        
+
         if (_facesInitializer != null && _servletContext != null)
         {
             _facesInitializer.destroyFaces(_servletContext);
@@ -124,17 +120,18 @@
         FactoryFinder.releaseFactories();
         _servletContext = null;
     }
-    
-    private void doPredestroy(ServletContextEvent event) {
-                
+
+    @SuppressWarnings("unchecked")
+    private void doPredestroy(ServletContextEvent event)
+    {
         ServletContext ctx = event.getServletContext();
-           Enumeration<String> attributes = ctx.getAttributeNames();
-           
-           while(attributes.hasMoreElements()) 
-           {
-               String name = attributes.nextElement();
-               Object value = ctx.getAttribute(name);
-               doPreDestroy(value, name, ManagedBeanBuilder.APPLICATION);
-           }
+        Enumeration<String> attributes = ctx.getAttributeNames();
+
+        while (attributes.hasMoreElements())
+        {
+            String name = attributes.nextElement();
+            Object value = ctx.getAttribute(name);
+            doPreDestroy(value, name, ManagedBeanBuilder.APPLICATION);
+        }
     }
 }

Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java?rev=698799&r1=698798&r2=698799&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/config/FacesConfigValidatorTestCase.java
Wed Sep 24 19:03:47 2008
@@ -18,18 +18,21 @@
 package org.apache.myfaces.config;
 
 import java.io.ByteArrayInputStream;
-import java.util.Iterator;
+import java.util.Collection;
 import java.util.List;
 
+import org.apache.myfaces.config.element.ManagedBean;
+import org.apache.myfaces.config.element.NavigationRule;
 import org.apache.myfaces.config.impl.digester.DigesterFacesConfigDispenserImpl;
 import org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl;
+import org.apache.myfaces.config.impl.digester.elements.FacesConfig;
 import org.apache.shale.test.base.AbstractJsfTestCase;
 
 public class FacesConfigValidatorTestCase extends AbstractJsfTestCase
 {
 
-    private FacesConfigDispenser dispenser;
-    private FacesConfigUnmarshaller unmarshaller;
+    private FacesConfigDispenser<FacesConfig> dispenser;
+    private FacesConfigUnmarshaller<FacesConfig> unmarshaller;
     
     public FacesConfigValidatorTestCase(String name)
     {
@@ -57,10 +60,10 @@
     
     public void testVerifyExistence(){
         
-        Iterator managedBeans = dispenser.getManagedBeans();
-        Iterator navRules = dispenser.getNavigationRules();
+        Collection<ManagedBean> managedBeans = dispenser.getManagedBeans();
+        Collection<NavigationRule> navRules = dispenser.getNavigationRules();
         
-        List list = FacesConfigValidator.validate(managedBeans, navRules, "C:/somePath/");
+        List<String> list = FacesConfigValidator.validate(managedBeans, navRules, "C:/somePath/");
         
         int expected = 3;
         



Mime
View raw message