You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2022/03/10 13:22:32 UTC

[myfaces-tobago] branch tobago-4.x updated: fix: "for" attribute wasn't detected

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch tobago-4.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-4.x by this push:
     new 0845fa0  fix: "for" attribute wasn't detected
0845fa0 is described below

commit 0845fa0635ed4cd95766eecb0fb0f014edcc0069
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Mar 10 14:15:06 2022 +0100

    fix: "for" attribute wasn't detected
    
    (cherry picked from commit 952c3587f4d6be00f57bfaf7c34918f7c204be7c)
---
 .../org/apache/myfaces/tobago/component/Attributes.java    |  3 +++
 .../myfaces/tobago/component/AttributesUnitTest.java       | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
index 65e2723..ae40836 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
@@ -450,6 +450,9 @@ public enum Attributes {
     try {
       return Attributes.valueOf(name);
     } catch (final IllegalArgumentException e) {
+      if (name.equals("for")) {
+        return Attributes.forValue;
+      }
       LOG.warn("Can't find enum for {} with name '{}'", Attributes.class.getName(), name);
       return null;
     }
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesUnitTest.java
new file mode 100644
index 0000000..bce739f
--- /dev/null
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesUnitTest.java
@@ -0,0 +1,14 @@
+package org.apache.myfaces.tobago.component;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class AttributesUnitTest {
+
+  @Test
+  void testValueOf() {
+    for (Attributes a : Attributes.values()) {
+      Assertions.assertEquals(a, Attributes.valueOfFailsafe(a.getName()));
+    }
+  }
+}