myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1442884 - /myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
Date Wed, 06 Feb 2013 10:09:11 GMT
Author: lofwyr
Date: Wed Feb  6 10:09:11 2013
New Revision: 1442884

URL: http://svn.apache.org/viewvc?rev=1442884&view=rev
Log:
slightly better program logic

Modified:
    myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java?rev=1442884&r1=1442883&r2=1442884&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
(original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
Wed Feb  6 10:09:11 2013
@@ -25,6 +25,7 @@ import org.apache.myfaces.tobago.config.
 import org.apache.myfaces.tobago.context.Theme;
 import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.internal.util.JndiUtils;
+import org.apache.myfaces.tobago.util.FacesVersion;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -234,20 +235,25 @@ public class TobagoConfigImpl extends To
   }
 
   public synchronized void initDefaultValidatorInfo() {
-    try {
+    if (FacesVersion.supports20()) {
       final FacesContext facesContext = FacesContext.getCurrentInstance();
       if (facesContext != null) {
-        final Application application = facesContext.getApplication();
-        final Map<String, String> map
-            = (Map<String, String>) PropertyUtils.getProperty(application, "defaultValidatorInfo");
-        if (application != null && map.size() > 0) {
-          defaultValidatorInfo = Collections.unmodifiableMap(map);
-        } else {
+        try {
+          final Application application = facesContext.getApplication();
+          final Map<String, String> map;
+          map = (Map<String, String>) PropertyUtils.getProperty(application, "defaultValidatorInfo");
+          if (application != null && map.size() > 0) {
+            defaultValidatorInfo = Collections.unmodifiableMap(map);
+          } else {
+            defaultValidatorInfo = Collections.emptyMap();
+          }
+        } catch (Exception e) {
+          // should not happen
+          LOG.error("Can't initialize default validators.", e);
           defaultValidatorInfo = Collections.emptyMap();
         }
       }
-    } catch (Exception e) {
-      LOG.info("Can't initialize default validators. (Will only work with JSF 2.0 and higher)");
+    } else {
       defaultValidatorInfo = Collections.emptyMap();
     }
   }



Mime
View raw message