You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/01/08 23:49:41 UTC

svn commit: r610210 - /myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java

Author: skitching
Date: Tue Jan  8 14:49:38 2008
New Revision: 610210

URL: http://svn.apache.org/viewvc?rev=610210&view=rev
Log:
Update static block to handle null FacesContext; this fixes problems with the tlddoc tool loading
this class without a normal JSF environment (for the purposes of introspection).

Modified:
    myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java

Modified: myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java?rev=610210&r1=610209&r2=610210&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java Tue Jan  8 14:49:38 2008
@@ -62,8 +62,18 @@
     static
     {
         FacesContext facesContext = FacesContext.getCurrentInstance();
-        CONVERTER_ID = facesContext.getApplication().getExpressionFactory().createValueExpression(
+        if (facesContext != null)
+        {
+            CONVERTER_ID = facesContext.getApplication().getExpressionFactory().createValueExpression(
                     facesContext.getELContext(),"javax.faces.DateTime",String.class);
+        }
+        else
+        {
+            // Handle null facesContext because some tools (eg the tlddoc generator)
+            // load classes in order to introspect them. Of course this class will
+            // never work correctly in its normal JSF environment if this case is used.
+            CONVERTER_ID = null;
+        }
     }
         
     public void release()
@@ -238,4 +248,4 @@
         }
 
 
-}
\ No newline at end of file
+}