You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2011/10/26 19:53:39 UTC

svn commit: r1189343 [2/2] - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces: renderkit/html/ taglib/core/ view/facelets/ view/facelets/compiler/ view/facelets/el/ view/facelets/impl/ view/facelets/tag/ view/facelets/tag/composite/ view/fa...

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java?rev=1189343&r1=1189342&r2=1189343&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java Wed Oct 26 17:53:36 2011
@@ -55,7 +55,8 @@ import java.util.logging.Logger;
 /**
  * Performs common initialization tasks.
  */
-public abstract class AbstractFacesInitializer implements FacesInitializer {
+public abstract class AbstractFacesInitializer implements FacesInitializer
+{
     /**
      * The logger instance for this class.
      */
@@ -95,9 +96,12 @@ public abstract class AbstractFacesIniti
      * Performs all necessary initialization tasks like configuring this JSF
      * application.
      */
-    public void initFaces(ServletContext servletContext) {
-        try {
-            if (log.isLoggable(Level.FINEST)) {
+    public void initFaces(ServletContext servletContext)
+    {
+        try
+        {
+            if (log.isLoggable(Level.FINEST))
+            {
                 log.finest("Initializing MyFaces");
             }
 
@@ -117,7 +121,8 @@ public abstract class AbstractFacesIniti
                 WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebConfigProviderFactory(
                         facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext());
 
-                if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty()) {
+                if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty())
+                {
                     // check if the FacesServlet has been added dynamically
                     // in a Servlet 3.0 environment by MyFacesContainerInitializer
                     Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
@@ -135,7 +140,8 @@ public abstract class AbstractFacesIniti
             initContainerIntegration(servletContext, externalContext);
 
             String useEncryption = servletContext.getInitParameter(StateUtils.USE_ENCRYPTION);
-            if (!"false".equals(useEncryption)) { // the default value is true
+            if (!"false".equals(useEncryption)) // the default value is true
+            {
                 StateUtils.initSecret(servletContext);
             }
 
@@ -186,7 +192,9 @@ public abstract class AbstractFacesIniti
                 log.log(Level.WARNING, message.toString());
             }
 
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             log.log(Level.SEVERE, "An error occured while initializing MyFaces: "
                       + ex.getMessage(), ex);
         }
@@ -265,7 +273,8 @@ public abstract class AbstractFacesIniti
      * @param eventClass     the class to be passed down into the dispatching
      *                       code
      */
-    private void _dispatchApplicationEvent(ServletContext servletContext, Class<? extends SystemEvent> eventClass) {
+    private void _dispatchApplicationEvent(ServletContext servletContext, Class<? extends SystemEvent> eventClass)
+    {
         FacesContext facesContext = FacesContext.getCurrentInstance();
         Application application = facesContext.getApplication();
         application.publishEvent(facesContext, eventClass, Application.class, application);
@@ -274,17 +283,19 @@ public abstract class AbstractFacesIniti
     /**
      * Cleans up all remaining resources (well, theoretically).
      */
-    public void destroyFaces(ServletContext servletContext) {
-        
+    public void destroyFaces(ServletContext servletContext)
+    {
+
         FacesContext facesContext = FacesContext.getCurrentInstance();
-        
+
         if (!WebConfigParamUtils.getBooleanInitParameter(facesContext.getExternalContext(), INITIALIZE_ALWAYS_STANDALONE, false))
         {
             //We need to check if the current application was initialized by myfaces
             WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebConfigProviderFactory(
                     facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext());
-            
-            if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty()) {
+
+            if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty())
+            {
                 // check if the FacesServlet has been added dynamically
                 // in a Servlet 3.0 environment by MyFacesContainerInitializer
                 Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
@@ -298,7 +309,7 @@ public abstract class AbstractFacesIniti
                 }
             }
         }
-        
+
         _dispatchApplicationEvent(servletContext, PreDestroyApplicationEvent.class);
 
         // clear the cache of MetaRulesetImpl in order to prevent a memory leak
@@ -306,7 +317,7 @@ public abstract class AbstractFacesIniti
 
         // TODO is it possible to make a real cleanup?
     }
-    
+
     /**
      * Configures this JSF application. It's required that every
      * FacesInitializer (i.e. every subclass) calls this method during
@@ -318,7 +329,8 @@ public abstract class AbstractFacesIniti
      * @return the current runtime configuration
      */
     protected RuntimeConfig buildConfiguration(ServletContext servletContext,
-                                               ExternalContext externalContext, ExpressionFactory expressionFactory) {
+                                               ExternalContext externalContext, ExpressionFactory expressionFactory)
+    {
         RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
         runtimeConfig.setExpressionFactory(expressionFactory);
 
@@ -330,13 +342,16 @@ public abstract class AbstractFacesIniti
         return runtimeConfig;
     }
 
-    protected void validateFacesConfig(ServletContext servletContext, ExternalContext externalContext) {
+    protected void validateFacesConfig(ServletContext servletContext, ExternalContext externalContext)
+    {
         String validate = servletContext.getInitParameter(FacesConfigValidator.VALIDATE_CONTEXT_PARAM);
-        if ("true".equals(validate) && log.isLoggable(Level.WARNING)) { // the default value is false
+        if ("true".equals(validate) && log.isLoggable(Level.WARNING))
+        { // the default value is false
             List<String> warnings = FacesConfigValidator.validate(
                     externalContext);
 
-            for (String warning : warnings) {
+            for (String warning : warnings)
+            {
                 log.warning(warning);
             }
         }
@@ -350,13 +365,16 @@ public abstract class AbstractFacesIniti
      * @return User-specified ExpressionFactory, or
      *         <code>null</code>, if no no custom implementation was specified
      */
-    protected static ExpressionFactory getUserDefinedExpressionFactory(ExternalContext externalContext) {
+    protected static ExpressionFactory getUserDefinedExpressionFactory(ExternalContext externalContext)
+    {
         String expressionFactoryClassName = WebConfigParamUtils.getStringInitParameter(externalContext, EXPRESSION_FACTORY);
         if (expressionFactoryClassName != null
-            && expressionFactoryClassName.trim().length() > 0) {
-            if (log.isLoggable(Level.FINE)) {
+                && expressionFactoryClassName.trim().length() > 0)
+        {
+            if (log.isLoggable(Level.FINE))
+            {
                 log.fine("Attempting to load the ExpressionFactory implementation "
-                          + "you've specified: '" + expressionFactoryClassName + "'.");
+                        + "you've specified: '" + expressionFactoryClassName + "'.");
             }
 
             return loadExpressionFactory(expressionFactoryClassName);
@@ -372,20 +390,25 @@ public abstract class AbstractFacesIniti
      * @return the newly created ExpressionFactory implementation, or
      *         <code>null</code>, if an error occurred
      */
-    protected static ExpressionFactory loadExpressionFactory(String expressionFactoryClassName) {
-        try {
+    protected static ExpressionFactory loadExpressionFactory(String expressionFactoryClassName)
+    {
+        try
+        {
             Class<?> expressionFactoryClass = Class.forName(expressionFactoryClassName);
             return (ExpressionFactory) expressionFactoryClass.newInstance();
-        } catch (Exception ex) {
-            if (log.isLoggable(Level.FINE)) {
+        }
+        catch (Exception ex)
+        {
+            if (log.isLoggable(Level.FINE))
+            {
                 log.log(Level.FINE, "An error occured while instantiating a new ExpressionFactory. "
-                          + "Attempted to load class '" + expressionFactoryClassName + "'.", ex);
+                        + "Attempted to load class '" + expressionFactoryClassName + "'.", ex);
             }
         }
 
         return null;
     }
-    
+
     public FacesContext initStartupFacesContext(ServletContext servletContext)
     {
         // We cannot use FacesContextFactory, because it is necessary to initialize 

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java?rev=1189343&r1=1189342&r2=1189343&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java Wed Oct 26 17:53:36 2011
@@ -73,8 +73,10 @@ public class Jsp20FacesInitializer exten
         // are available).
         ExpressionFactory expressionFactory = getUserDefinedExpressionFactory(externalContext);
 
-        if (expressionFactory == null) {
-            if (log.isLoggable(Level.INFO)) {
+        if (expressionFactory == null)
+        {
+            if (log.isLoggable(Level.INFO))
+            {
                 log.info("Either you haven't specified the ExpressionFactory implementation, or an " 
                         + "error occured while instantiating the implementation you've specified. "
                         + "However, attempting to load a known implementation.");

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp21FacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp21FacesInitializer.java?rev=1189343&r1=1189342&r2=1189343&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp21FacesInitializer.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/Jsp21FacesInitializer.java Wed Oct 26 17:53:36 2011
@@ -79,14 +79,20 @@ public class Jsp21FacesInitializer exten
     
     protected JspFactory getJspFactory()
     {
-        if (jspFactory == null) {
+        if (jspFactory == null)
+        {
             // TODO: this Class.forName will be removed when Tomcat fixes a bug
             // also, we should then be able to remove jasper.jar from the deployment
-            try {
+            try
+            {
                 Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
-            } catch (ClassNotFoundException e) {
-                ; // ignore
-            } catch (Exception ex) {
+            }
+            catch (ClassNotFoundException e)
+            {
+                // ignore
+            }
+            catch (Exception ex)
+            {
                 log.log(Level.FINE, "An unexpected exception occured "
                         + "while loading the JspRuntimeContext.", ex);
             }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupListener.java?rev=1189343&r1=1189342&r2=1189343&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupListener.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupListener.java Wed Oct 26 17:53:36 2011
@@ -30,7 +30,8 @@ import javax.servlet.ServletContextEvent
  *
  * @author Werner Punz
  */
-public interface StartupListener {
+public interface StartupListener
+{
     /**
      * This method is called before myfaces initializes
      *

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java?rev=1189343&r1=1189342&r2=1189343&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java Wed Oct 26 17:53:36 2011
@@ -214,7 +214,8 @@ public class StartupServletContextListen
         for(String plugin: pluginEntries)
         {
             log.info("Processing plugin:"+plugin);
-            try {
+            try
+            {
                 //for now the initializers have to be stateless to
                 //so that we do not have to enforce that the initializer
                 //must be serializable