You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2011/10/17 23:29:42 UTC

svn commit: r1185384 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java

Author: bommel
Date: Mon Oct 17 21:29:42 2011
New Revision: 1185384

URL: http://svn.apache.org/viewvc?rev=1185384&view=rev
Log:
workaround for an other myfaces-2.0 bug

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
    myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java?rev=1185384&r1=1185383&r2=1185384&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java Mon Oct 17 21:29:42 2011
@@ -27,6 +27,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
 import org.apache.myfaces.tobago.util.ApplyRequestValuesCallback;
 import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.util.FacesVersion;
 import org.apache.myfaces.tobago.util.ProcessValidationsCallback;
 import org.apache.myfaces.tobago.util.TobagoCallback;
 import org.apache.myfaces.tobago.util.UpdateModelValuesCallback;
@@ -235,6 +236,15 @@ public class UIViewRoot extends javax.fa
     UIComponent actionComponent = null;
     if (actionId != null) {
       actionComponent = findComponent(actionId);
+      if (actionComponent == null && FacesVersion.supports20() && FacesVersion.isMyfaces()) {
+        String bugActionId = actionId.replaceAll(":\\d+:", ":");
+        try {
+          actionComponent = findComponent(bugActionId);
+          LOG.info("command = \"" + actionComponent + "\"", new Exception());
+        } catch (Exception e) {
+          // ignore
+        }
+      }
     }
     if (actionComponent == null) {
       return;

Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java?rev=1185384&r1=1185383&r2=1185384&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java Mon Oct 17 21:29:42 2011
@@ -23,7 +23,8 @@ public enum FacesVersion {
 
   VERSION_11,
   VERSION_12,
-  VERSION_20;
+  VERSION_20,
+  VERSION_21;
 
   private static FacesVersion currentVersion;
   private static boolean mojarra;
@@ -31,21 +32,17 @@ public enum FacesVersion {
 
   static {
     try {
+      currentVersion = VERSION_11;
       Application.class.getMethod("getExpressionFactory");
-
-      try {
-        Application.class.getMethod("getExceptionHandler");
-
-        currentVersion = VERSION_20;
-
-
-      } catch (NoSuchMethodException e) {
-        currentVersion = VERSION_12;
-      }
-
+      currentVersion = VERSION_12;
+      Application.class.getMethod("getDefaultValidatorInfo");
+      currentVersion = VERSION_20;
+      Application.class.getMethod("getExceptionHandler");
+      currentVersion = VERSION_21;
     } catch (NoSuchMethodException e) {
-      currentVersion = VERSION_11;
+      // ignore
     }
+
     mojarra = isAvailable("com.sun.faces.application.ApplicationImpl");
     myfaces = isAvailable("org.apache.myfaces.application.ApplicationImpl");
 
@@ -76,7 +73,7 @@ public enum FacesVersion {
    * @return Supports 1.2 or higher
    */
   public static boolean supports12() {
-    return currentVersion == VERSION_12 || currentVersion == VERSION_20;
+    return currentVersion == VERSION_12 || currentVersion == VERSION_20 || currentVersion == VERSION_21;
   }
 
   /**
@@ -84,7 +81,15 @@ public enum FacesVersion {
    * @return Supports 2.0 or higher
    */
   public static boolean supports20() {
-    return currentVersion == VERSION_20;
+    return currentVersion == VERSION_20 || currentVersion == VERSION_21;
+  }
+
+  /**
+   * Does the JSF is version 2.1 or higher
+   * @return Supports 2.1 or higher
+   */
+  public static boolean supports21() {
+    return currentVersion == VERSION_21;
   }
 
   public static boolean isMojarra() {