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 2021/04/07 21:22:15 UTC

[myfaces-tobago] branch tobago-4.x updated: fix: NullPointerException in tc:operation for attribute issue: TOBAGO-2009

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 1303b6f  fix: NullPointerException in tc:operation for attribute issue: TOBAGO-2009
1303b6f is described below

commit 1303b6f98a4c421b8ec1a972c52de5a9d0e3e8fa
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Apr 7 23:20:57 2021 +0200

    fix: NullPointerException in tc:operation for attribute
    issue: TOBAGO-2009
---
 .../renderkit/renderer/TobagoClientBehaviorRenderer.java       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java
index 5d7de1e..d2ef014 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TobagoClientBehaviorRenderer.java
@@ -33,6 +33,7 @@ import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.el.ValueExpression;
 import javax.faces.component.ActionSource;
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
@@ -212,7 +213,14 @@ public class TobagoClientBehaviorRenderer extends javax.faces.render.ClientBehav
     Collapse collapse = null;
     if (operations.size() > 0) {
       final AbstractUIOperation operation = operations.get(0);
-      final String forId = ComponentUtils.evaluateClientId(facesContext, component, operation.getFor());
+      final ValueExpression valueExpression = operation.getValueExpression("for");
+      final String value;
+      if (valueExpression != null) {
+        value = (String) valueExpression.getValue(facesContext.getELContext());
+      } else {
+        value = operation.getFor();
+      }
+      final String forId = ComponentUtils.evaluateClientId(facesContext, component, value);
       collapse = new Collapse(Collapse.Action.valueOf(operation.getName()), forId);
     }