dev@javaserverfaces.java.net

[REVIEW] Misc cleanup and small change to PostConstruct/PreDestroy annotation handling.

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Thu, 12 Jan 2006 11:47:33 -0800

See attached.


SECTION: Modified Files
----------------------------


M jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java
M jsf-ri/src/com/sun/faces/util/MessageUtils.java
M jsf-ri/src/javax/faces/Messages.properties
M jsf-ri/src/javax/faces/Messages_de.properties
M jsf-ri/src/javax/faces/Messages_en.properties
M jsf-ri/src/javax/faces/Messages_es.properties
M jsf-ri/src/javax/faces/Messages_fr.properties
M jsf-tools/template-src/MessageFactory.java
  - misc cleanup (leverage varags)

M jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java
M jsf-ri/src/com/sun/faces/util/Util.java
M jsf-ri/src/com/sun/faces/LogStrings.properties
  - Remove hard compile/runtime dependency on
    PostConstruct and PreDestroy annotations.




SECTION: Diffs
----------------------------
Index: jsf-ri/src/com/sun/faces/LogStrings.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/LogStrings.properties,v
retrieving revision 1.4
diff -u -r1.4 LogStrings.properties
--- jsf-ri/src/com/sun/faces/LogStrings.properties 3 Nov 2005 19:18:21 -0000 1.4
+++ jsf-ri/src/com/sun/faces/LogStrings.properties 12 Jan 2006 19:03:04 -0000
@@ -35,6 +35,6 @@
 jsf.illegal_view_id_error=JSF1010: Illegal view ID {0}. The ID must begin with ''/''
 jsf.navigation.no_matching_outcome="JSF1012: Unable to find matching navigation case from view ID ''{0}'' for outcome ''{1}''
 jsf.navigation.no_matching_outcome_action="JSF1013: Unable to find matching navigation case from view ID ''{0}'' for outcome ''{1}'' and action ''{2}''
-
+jsf.util_no_annotation_processed="JSF1014: Unable to load annotation class ''{0}''. As a result, this annotation will not be processed.
 # core tags
 jsf.core.tags.eval_result_not_expected_type=JSF1011: Evaluation of expression for attribute ''{0}'' resulted in unexpected type. Expected {1}, but received {2}.
Index: jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java,v
retrieving revision 1.24
diff -u -r1.24 ApplicationAssociate.java
--- jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java 11 Jan 2006 15:28:02 -0000 1.24
+++ jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java 12 Jan 2006 19:03:04 -0000
@@ -54,13 +54,13 @@
 import com.sun.faces.config.beans.ResourceBundleBean;
 import com.sun.faces.util.Util;
 import com.sun.faces.util.MessageUtils;
+import static com.sun.faces.util.Util.Annotations;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Locale;
 import java.util.ResourceBundle;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
+
 import javax.faces.component.UIViewRoot;
 import javax.servlet.ServletContext;
 
@@ -574,9 +574,9 @@
                      IllegalArgumentException,
                      InvocationTargetException {
         List<Method> postConstructs = Util.getMethodsWithAnnotation(bean,
- PostConstruct.class);
+ Annotations.POST_CONSTRUCT);
         List<Method> preDestroys = Util.getMethodsWithAnnotation(bean,
- PreDestroy.class);
+ Annotations.PRE_DESTROY);
         assert(null != postConstructs && null != preDestroys);
         
         for (Method method : postConstructs) {
Index: jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java,v
retrieving revision 1.7
diff -u -r1.7 ImplicitObjectELResolverForJsp.java
--- jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java 11 Jan 2006 15:28:05 -0000 1.7
+++ jsf-ri/src/com/sun/faces/el/ImplicitObjectELResolverForJsp.java 12 Jan 2006 19:03:04 -0000
@@ -127,10 +127,10 @@
         switch (index) {
             case FACES_CONTEXT:
                 throw new PropertyNotWritableException(MessageUtils.getExceptionMessageString
- (MessageUtils.OBJECT_IS_READONLY, new String[]{"facesContext"}));
+ (MessageUtils.OBJECT_IS_READONLY, "facesContext"));
             case VIEW:
                 throw new PropertyNotWritableException(MessageUtils.getExceptionMessageString
- (MessageUtils.OBJECT_IS_READONLY, new String[]{"view"}));
+ (MessageUtils.OBJECT_IS_READONLY, "view"));
             default:
         }
     }
Index: jsf-ri/src/com/sun/faces/util/MessageUtils.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/MessageUtils.java,v
retrieving revision 1.1
diff -u -r1.1 MessageUtils.java
--- jsf-ri/src/com/sun/faces/util/MessageUtils.java 11 Jan 2006 15:28:14 -0000 1.1
+++ jsf-ri/src/com/sun/faces/util/MessageUtils.java 12 Jan 2006 19:03:04 -0000
@@ -226,22 +226,7 @@
 
 
     // ---------------------------------------------------------- Public Methods
-
-
- /**
- * <p>Creates a new <code>FacesMessage</code> instance using the
- * specified #messageId.</p>
- *
- * @param messageId the message ID
- * @return a new <code>FacesMessage</code> based on the provided
- * <code>messageId</code>
- */
- public static synchronized FacesMessage getExceptionMessage(
- String messageId) {
-
- return getExceptionMessage(messageId, null);
-
- }
+
 
     /**
      * <p>Creates a new <code>FacesMessage</code> instance using the
@@ -254,27 +239,11 @@
      */
     public static synchronized FacesMessage getExceptionMessage(
           String messageId,
- Object[] params) {
+ Object... params) {
 
         return MessageFactory.getMessage(messageId, params);
 
- }
-
-
- /**
- * <p>Returns the localized message for the specified
- * #messageId.</p>
- *
- * @param messageId the message ID
- * @return the localized message for the specified
- * <code>messageId</code>
- */
- public static synchronized String getExceptionMessageString(
- String messageId) {
-
- return getExceptionMessageString(messageId, null);
-
- }
+ }
 
 
     /**
@@ -288,7 +257,7 @@
      */
     public static synchronized String getExceptionMessageString(
           String messageId,
- Object[] params) {
+ Object... params) {
 
         String result = null;
 
Index: jsf-ri/src/com/sun/faces/util/Util.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/Util.java,v
retrieving revision 1.182
diff -u -r1.182 Util.java
--- jsf-ri/src/com/sun/faces/util/Util.java 11 Jan 2006 15:28:14 -0000 1.182
+++ jsf-ri/src/com/sun/faces/util/Util.java 12 Jan 2006 19:03:04 -0000
@@ -31,10 +31,9 @@
 
 package com.sun.faces.util;
 
-import com.sun.faces.RIConstants;
-import com.sun.faces.renderkit.RenderKitImpl;
-import java.beans.FeatureDescriptor;
-
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.ValueExpression;
 import javax.faces.FacesException;
 import javax.faces.FactoryFinder;
 import javax.faces.application.Application;
@@ -42,39 +41,36 @@
 import javax.faces.application.StateManager;
 import javax.faces.application.ViewHandler;
 import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectItem;
-import javax.faces.component.UISelectItems;
+import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.FacesContextFactory;
 import javax.faces.convert.Converter;
 import javax.faces.el.ReferenceSyntaxException;
-import javax.el.ValueExpression;
-import javax.el.ELContext;
+import javax.faces.el.ValueBinding;
 import javax.faces.lifecycle.LifecycleFactory;
-import javax.faces.model.SelectItem;
 import javax.faces.render.RenderKit;
 import javax.faces.render.RenderKitFactory;
 import javax.servlet.ServletContext;
-import javax.faces.el.ValueBinding;
 import javax.servlet.jsp.jstl.fmt.LocalizationContext;
 
+import java.beans.FeatureDescriptor;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.logging.Logger;
 import java.util.logging.Level;
-import javax.el.ELResolver;
-import javax.faces.component.UIViewRoot;
+import java.util.logging.Logger;
 
+import com.sun.faces.RIConstants;
+import com.sun.faces.renderkit.RenderKitImpl;
 import com.sun.faces.spi.ManagedBeanFactory.Scope;
 
 /**
@@ -109,6 +105,36 @@
     public static final String CONTEXT_LOGGER = ".context";
     public static final String CONFIG_LOGGER = ".config";
     public static final String LIFECYCLE_LOGGER = ".lifecycle";
+
+ public static enum Annotations {
+ POST_CONSTRUCT("javax.annotation.PostConstruct"),
+ PRE_DESTROY("javax.annotation.PreDestroy");
+
+ Annotations(String annotationClassName) {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader != null) {
+ try {
+ annotationClass =
+ loader.loadClass(annotationClassName);
+ if (!annotationClass.isAnnotation()) {
+ annotationClass = null;
+ }
+ } catch (ClassNotFoundException cne) {
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.log(Level.INFO,
+ "jsf.util_no_annotation_processed",
+ annotationClassName);
+ }
+ }
+ }
+ }
+
+ private Class annotationClass;
+
+ public Class getAnnotationClass() {
+ return annotationClass;
+ }
+ }
 
     /**
      * Flag that, when true, enables special behavior in the RI to enable
@@ -795,7 +821,7 @@
      * <code>sessionScope.TestBean.one</code> should return "session"
      * as the scope.</p>
      *
- * @param ValueExpression the expression
+ * @param valueBinding the expression
      *
      * @param outString an allocated String Array into which we put the
      * first segment.
@@ -1043,6 +1069,7 @@
         // Look for the presence of the method by method name.
         Class c = instance.getClass();
         Method[] methods = c.getDeclaredMethods();
+
         for (int i = 0; i < methods.length; i++) {
             if (methods[i].getName().equals(methodName)) {
                 result = true;
@@ -1058,29 +1085,34 @@
      * referenced by argument <code>annoClass</code>. If none are
      * found, returns the empty list.
      *
- * @param the instance for which to inspect for annotated methods
+ * @param obj instance for which to inspect for annotated methods
      *
- * @param annoClass the Class of annotation to look for
+ * @param annotation the <code>Annotation</code> of interest
      */
-
- public static List<Method> getMethodsWithAnnotation(Object obj, Class annoClass) {
+
+ public static List<Method> getMethodsWithAnnotation(Object obj,
+ Annotations annotation) {
         List<Method> list = null;
         Method [] methods = null;
         if (null != obj) {
+ Class<? extends Annotation> annoClass = annotation.getAnnotationClass();
+ if (annoClass == null) {
+ return Collections.emptyList();
+ }
             Class objClass = obj.getClass();
             methods = objClass.getMethods();
 
- for (int i = 0; i < methods.length; i++) {
- if (null != methods[i].getAnnotation(annoClass)) {
- if (null == list) {
- list = new ArrayList<Method>();
- }
- list.add(methods[i]);
- }
+ for (Method method : methods) {
+ if (null != method.getAnnotation(annoClass)) {
+ if (null == list) {
+ list = new ArrayList<Method>();
+ }
+ list.add(method);
+ }
             }
- }
+ }
         if (null == list) {
- list = Collections.EMPTY_LIST;
+ list = Collections.emptyList();
         }
         return list;
     }
Index: jsf-ri/src/javax/faces/Messages.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/javax/faces/Messages.properties,v
retrieving revision 1.35
diff -u -r1.35 Messages.properties
--- jsf-ri/src/javax/faces/Messages.properties 22 Nov 2005 18:48:35 -0000 1.35
+++ jsf-ri/src/javax/faces/Messages.properties 12 Jan 2006 19:03:04 -0000
@@ -183,7 +183,7 @@
 com.sun.faces.VALIDATOR_NOT_FOUND_ERROR=Validator Not Found for identifier: ''{0}''.
 
 
-com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cycle reference to managed bean "{0}"
+com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cyclic reference to managed bean "{0}"
 com.sun.faces.OBJECT_IS_READONLY="{0} object is read only"
 com.sun.faces.APPLICATION_INIT_COMPLETE_ERROR_ID=ELResolvers cannot be added after the application initialization is complete.
 com.sun.faces.INCORRECT_JSP_VERSION=Incorrect JSP version found, method ''{0}'' does not exist.
Index: jsf-ri/src/javax/faces/Messages_de.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/javax/faces/Messages_de.properties,v
retrieving revision 1.31
diff -u -r1.31 Messages_de.properties
--- jsf-ri/src/javax/faces/Messages_de.properties 22 Nov 2005 18:48:36 -0000 1.31
+++ jsf-ri/src/javax/faces/Messages_de.properties 12 Jan 2006 19:03:04 -0000
@@ -165,7 +165,7 @@
 com.sun.faces.ASSERTION_FAILED=Assertion-Fehler
 com.sun.faces.OBJECT_CREATION_ERROR=One or more confgured application objects could not be created. Check your web application logs for details.
 
-com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cycle reference to managed bean "{0}"
+com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cyclic reference to managed bean "{0}"
 
 com.sun.faces.OBJECT_IS_READONLY="{0} object is read only"
 com.sun.faces.APPLICATION_INIT_COMPLETE_ERROR_ID=ELResolvers cannot be added after the application initialization is complete.
Index: jsf-ri/src/javax/faces/Messages_en.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/javax/faces/Messages_en.properties,v
retrieving revision 1.4
diff -u -r1.4 Messages_en.properties
--- jsf-ri/src/javax/faces/Messages_en.properties 22 Nov 2005 18:48:36 -0000 1.4
+++ jsf-ri/src/javax/faces/Messages_en.properties 12 Jan 2006 19:03:04 -0000
@@ -183,7 +183,7 @@
 com.sun.faces.VALIDATOR_NOT_FOUND_ERROR=Validator Not Found for identifier: ''{0}''.
 
 
-com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cycle reference to managed bean "{0}"
+com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cyclic reference to managed bean "{0}"
 com.sun.faces.OBJECT_IS_READONLY="{0} object is read only"
 com.sun.faces.APPLICATION_INIT_COMPLETE_ERROR_ID=ELResolvers cannot be added after the application initialization is complete.
 com.sun.faces.INCORRECT_JSP_VERSION=Incorrect JSP version found, method ''{0}'' does not exist.
Index: jsf-ri/src/javax/faces/Messages_es.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/javax/faces/Messages_es.properties,v
retrieving revision 1.31
diff -u -r1.31 Messages_es.properties
--- jsf-ri/src/javax/faces/Messages_es.properties 22 Nov 2005 18:48:36 -0000 1.31
+++ jsf-ri/src/javax/faces/Messages_es.properties 12 Jan 2006 19:03:04 -0000
@@ -165,7 +165,7 @@
 com.sun.faces.ASSERTION_FAILED=Assertion Error
 com.sun.faces.OBJECT_CREATION_ERROR=One or more confgured application objects could not be created. Check your web application logs for details.
 
-com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cycle reference to managed bean "{0}"
+com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cyclic reference to managed bean "{0}"
 
 com.sun.faces.OBJECT_IS_READONLY="{0} object is read only"
 com.sun.faces.APPLICATION_INIT_COMPLETE_ERROR_ID=ELResolvers cannot be added after the application initialization is complete.
Index: jsf-ri/src/javax/faces/Messages_fr.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/javax/faces/Messages_fr.properties,v
retrieving revision 1.30
diff -u -r1.30 Messages_fr.properties
--- jsf-ri/src/javax/faces/Messages_fr.properties 22 Nov 2005 18:48:37 -0000 1.30
+++ jsf-ri/src/javax/faces/Messages_fr.properties 12 Jan 2006 19:03:04 -0000
@@ -164,7 +164,7 @@
 com.sun.faces.ASSERTION_FAILED=Assertion Failed
 com.sun.faces.OBJECT_CREATION_ERROR=One or more confgured application objects could not be created. Check your web application logs for details.
 
-com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cycle reference to managed bean "{0}"
+com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cyclic reference to managed bean "{0}"
 com.sun.faces.OBJECT_IS_READONLY="{0} object is read only"
 com.sun.faces.APPLICATION_INIT_COMPLETE_ERROR_ID=ELResolvers cannot be added after the application initialization is complete.
 com.sun.faces.INCORRECT_JSP_VERSION=Incorrect JSP version found, method ''{0}'' does not exist.
Index: jsf-tools/template-src/MessageFactory.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-tools/template-src/MessageFactory.java,v
retrieving revision 1.10
diff -u -r1.10 MessageFactory.java
--- jsf-tools/template-src/MessageFactory.java 22 Aug 2005 22:12:29 -0000 1.10
+++ jsf-tools/template-src/MessageFactory.java 12 Jan 2006 19:03:06 -0000
@@ -58,47 +58,17 @@
  * <code>protection</code>.</p>
  */
 
-_at_protection@ class MessageFactory extends Object
-{
- //
- // Protected Constants
- //
-
- //
- // Class Variables
- //
-
- //
- // Instance Variables
- //
-
- // Attribute Instance Variables
-
- // Relationship Instance Variables
-
- //
- // Constructors and Initializers
- //
+_at_protection@ class MessageFactory {
 
     private MessageFactory() {
     }
-
- //
- // Class methods
- //
-
- //
- // General Methods
- //
-
+
     /**
-
- * This version of getMessage() is used in the RI for localizing RI
- * specific messages.
-
- */
-
- @protection@ static FacesMessage getMessage(String messageId, Object params[]) {
+ * This version of getMessage() is used for localizing implementation
+ * specific messages.
+ */
+ @protection@ static FacesMessage getMessage(String messageId,
+ Object... params) {
         Locale locale = null;
         FacesContext context = FacesContext.getCurrentInstance();
         // context.getViewRoot() may not have been initialized at this point.
@@ -111,79 +81,80 @@
             locale = Locale.getDefault();
         }
         
- return getMessage(locale, messageId, params);
+ return getMessage(locale, messageId, params);
     }
 
- @protection@ static FacesMessage getMessage(Locale locale, String messageId,
- Object params[]) {
- FacesMessage result = null;
- String
- summary = null,
- detail = null,
- bundleName = null;
- ResourceBundle bundle = null;
-
- // see if we have a user-provided bundle
- if (null != (bundleName = getApplication().getMessageBundle())) {
- if (null !=
- (bundle =
- ResourceBundle.getBundle(bundleName, locale,
- getCurrentLoader(bundleName)))) {
- // see if we have a hit
- try {
- summary = bundle.getString(messageId);
+ @protection@ static FacesMessage getMessage(Locale locale,
+ String messageId,
+ Object... params) {
+ FacesMessage result = null;
+ String summary = null;
+ String detail = null;
+ String bundleName = null;
+ ResourceBundle bundle = null;
+
+ // see if we have a user-provided bundle
+ if (null != (bundleName = getApplication().getMessageBundle())) {
+ if (null !=
+ (bundle =
+ ResourceBundle.getBundle(bundleName, locale,
+ getCurrentLoader(bundleName)))) {
+ // see if we have a hit
+ try {
+ summary = bundle.getString(messageId);
                     detail = bundle.getString(messageId + "_detail");
- }
- catch (MissingResourceException e) {
- }
- }
- }
-
- // we couldn't find a summary in the user-provided bundle
- if (null == summary) {
- // see if we have a summary in the app provided bundle
- bundle = ResourceBundle.getBundle(FacesMessage.FACES_MESSAGES,
- locale,
- getCurrentLoader(bundleName));
- if (null == bundle) {
- throw new NullPointerException();
- }
- // see if we have a hit
- try {
- summary = bundle.getString(messageId);
+ }
+ catch (MissingResourceException e) {
+ }
+ }
+ }
+
+ // we couldn't find a summary in the user-provided bundle
+ if (null == summary) {
+ // see if we have a summary in the app provided bundle
+ bundle = ResourceBundle.getBundle(FacesMessage.FACES_MESSAGES,
+ locale,
+ getCurrentLoader(bundleName));
+ if (null == bundle) {
+ throw new NullPointerException();
+ }
+ // see if we have a hit
+ try {
+ summary = bundle.getString(messageId);
                 detail = bundle.getString(messageId + "_detail");
- }
- catch (MissingResourceException e) {
- }
- }
-
- // we couldn't find a summary anywhere! Return null
- if (null == summary) {
- return null;
- }
-
- if (null == summary || null == bundle) {
- throw new NullPointerException(" summary " + summary + " bundle " +
- bundle);
- }
- // At this point, we have a summary and a bundle.
- //
+ } catch (MissingResourceException e) {
+ }
+ }
+
+ // we couldn't find a summary anywhere! Return null
+ if (null == summary) {
+ return null;
+ }
+
+ if (null == summary || null == bundle) {
+ throw new NullPointerException(" summary "
+ + summary
+ + " bundle "
+ + bundle);
+ }
+ // At this point, we have a summary and a bundle.
         return (new BindingFacesMessage(locale, summary, detail, params));
     }
 
 
     //
     // Methods from MessageFactory
- //
- @protection@ static FacesMessage getMessage(FacesContext context, String messageId) {
- return getMessage(context, messageId, null);
- }
+ //
     
- @protection@ static FacesMessage getMessage(FacesContext context, String messageId,
- Object params[]) {
+ @protection@ static FacesMessage getMessage(FacesContext context,
+ String messageId,
+ Object... params) {
+
         if (context == null || messageId == null ) {
- throw new NullPointerException(" context " + context + " messageId " +
- messageId);
+ throw new NullPointerException(" context "
+ + context
+ + " messageId "
+ + messageId);
         }
         Locale locale = null;
         // viewRoot may not have been initialized at this point.
@@ -192,9 +163,11 @@
         } else {
             locale = Locale.getDefault();
         }
- if (null == locale) {
- throw new NullPointerException(" locale " + locale);
- }
+
+ if (null == locale) {
+ throw new NullPointerException(" locale " + locale);
+ }
+
         FacesMessage message = getMessage(locale, messageId, params);
         if (message != null) {
             return message;
@@ -202,35 +175,12 @@
         locale = Locale.getDefault();
         return (getMessage(locale, messageId, params));
     }
-
- @protection@ static FacesMessage getMessage(FacesContext context, String messageId,
- Object param0) {
- return getMessage(context, messageId, new Object[]{param0});
- }
-
- @protection@ static FacesMessage getMessage(FacesContext context, String messageId,
- Object param0, Object param1) {
- return getMessage(context, messageId, new Object[]{param0, param1});
- }
-
- @protection@ static FacesMessage getMessage(FacesContext context, String messageId,
- Object param0, Object param1,
- Object param2) {
- return getMessage(context, messageId,
- new Object[]{param0, param1, param2});
- }
-
- @protection@ static FacesMessage getMessage(FacesContext context, String messageId,
- Object param0, Object param1,
- Object param2, Object param3) {
- return getMessage(context, messageId,
- new Object[]{param0, param1, param2, param3});
- }
+
 
     // Gets the "label" property from the component.
-
     @protection@ static Object getLabel(FacesContext context,
- UIComponent component) {
+ UIComponent component) {
+
         Object o = component.getAttributes().get("label");
         if (o == null || (o instanceof String && ((String) o).length() == 0)) {
             o = component.getValueBinding("label");
@@ -243,22 +193,22 @@
     }
 
     protected static Application getApplication() {
- FacesContext context = FacesContext.getCurrentInstance();
- if (context != null) {
- return (FacesContext.getCurrentInstance().getApplication());
- }
- ApplicationFactory afactory = (ApplicationFactory)
- FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
- return (afactory.getApplication());
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (context != null) {
+ return (FacesContext.getCurrentInstance().getApplication());
+ }
+ ApplicationFactory afactory = (ApplicationFactory)
+ FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+ return (afactory.getApplication());
     }
 
     protected static ClassLoader getCurrentLoader(Object fallbackClass) {
         ClassLoader loader =
- Thread.currentThread().getContextClassLoader();
- if (loader == null) {
- loader = fallbackClass.getClass().getClassLoader();
- }
- return loader;
+ Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ loader = fallbackClass.getClass().getClassLoader();
+ }
+ return loader;
     }
 
     /**
@@ -347,4 +297,5 @@
         private Object[] parameters;
         private Object[] resolvedParameters;
     }
+
 } // end of class MessageFactory