myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r641511 - /myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
Date Wed, 26 Mar 2008 19:41:58 GMT
Author: lu4242
Date: Wed Mar 26 12:41:56 2008
New Revision: 641511

URL: http://svn.apache.org/viewvc?rev=641511&view=rev
Log:
fix(MYFACES-1843) Configuration cleanup fail on some specific machine configurations

Modified:
    myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java

Modified: myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?rev=641511&r1=641510&r2=641511&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
(original)
+++ myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
Wed Mar 26 12:41:56 2008
@@ -131,8 +131,26 @@
     {
         if (initializingRuntimeConfig.get() == null)
         {
-            throw new IllegalStateException("The runtime config instance which is created
while initialize myfaces "
-                    + "must be set through ApplicationImpl.setInitializingRuntimeConfig");
+            //It may happen that the current thread value
+            //for initializingRuntimeConfig is not set 
+            //(note that this value is final, so it just 
+            //allow set only once per thread).
+            //So the better for this case is try to get
+            //the value using RuntimeConfig.getCurrentInstance()
+            //instead throw an IllegalStateException (only fails if
+            //the constructor is called before setInitializingRuntimeConfig).
+            //From other point of view, AbstractFacesInitializer do 
+            //the same as below, so there is not problem if
+            //we do this here and this is the best place to do
+            //this.
+            //log.info("initializingRuntimeConfig.get() == null, so loading from ExternalContext");
+            ApplicationImpl.setInitializingRuntimeConfig(
+                    RuntimeConfig.getCurrentInstance(
+                            FacesContext.getCurrentInstance()
+                            .getExternalContext()));
+
+            //throw new IllegalStateException("The runtime config instance which is created
while initialize myfaces "
+            //        + "must be set through ApplicationImpl.setInitializingRuntimeConfig");
         }
         return initializingRuntimeConfig.get();
     }



Mime
View raw message