Author: mrdon
Date: Sat May 20 23:24:37 2006
New Revision: 408140

URL: http://svn.apache.org/viewvc?rev=408140&view=rev
Log:
Fixing jsf setup interceptor to not complain so loudly if jsf isn't present, 
fixed freemarker
test to properly extend StrutsTestCase

Modified:
    
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java
    
struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java

Modified: 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java
URL: 
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java?rev=408140&r1=408139&r2=408140&view=diff
==============================================================================
--- 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java
 (original)
+++ 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java
 Sat May 20 23:24:37 2006
@@ -57,8 +57,17 @@
         * Initializes the lifecycle and factories
         */
        public void init() {
-               facesContextFactory = (FacesContextFactory) FactoryFinder
+               try {
+                       facesContextFactory = (FacesContextFactory) 
FactoryFinder
                                
.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+               } catch (Exception ex) {
+                       log.debug("Unable to initialize faces", ex);
+               }
+               
+               if (facesContextFactory == null) {
+                       log.info("Unable to initialize jsf interceptors 
probably due missing JSF framework initialization");
+                       return;
+               }
                // Javadoc says: Lifecycle instance is shared across multiple
                // simultaneous requests, it must be implemented in a 
thread-safe
                // manner.

Modified: 
struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java
URL: 
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java?rev=408140&r1=408139&r2=408140&view=diff
==============================================================================
--- 
struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java
 (original)
+++ 
struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java
 Sat May 20 23:24:37 2006
@@ -18,16 +18,15 @@
 package org.apache.struts.action2.views.freemarker;
 
 import org.apache.struts.action2.StrutsConstants;
+import org.apache.struts.action2.StrutsTestCase;
 import org.apache.struts.action2.config.Configuration;
 import org.apache.struts.action2.views.jsp.StrutsMockServletContext;
 
-import junit.framework.TestCase;
-
 /**
  * Test case for FreemarkerManager 
  * 
  */
-public class FreemarkerManagerTest extends TestCase {
+public class FreemarkerManagerTest extends StrutsTestCase {
        
        public void testIfStrutsEncodingIsSetProperty() throws Exception {
                Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, 
"UTF-8");


Reply via email to