myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject [myfaces-tobago] branch master updated: Prevent NullPointerException
Date Wed, 06 Mar 2019 10:59:12 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new b099b53  Prevent NullPointerException
b099b53 is described below

commit b099b53b614c54d6cb50fe4054547f1c1de911d6
Author: Udo Schnurpfeil <lofwyr@apache.org>
AuthorDate: Wed Mar 6 11:59:00 2019 +0100

    Prevent NullPointerException
---
 .../internal/renderkit/renderer/CommandRendererBase.java      | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
index c553a63..a3b1a39 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
@@ -45,16 +45,21 @@ import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIParameter;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
+import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.List;
 
 public abstract class CommandRendererBase extends DecodingCommandRendererBase {
 
+  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
   @Override
   public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws
IOException {
 
@@ -124,7 +129,11 @@ public abstract class CommandRendererBase extends DecodingCommandRendererBase
{
     final boolean defaultCommand = ComponentUtils.getBooleanAttribute(command, Attributes.defaultCommand);
     if (defaultCommand) {
       final AbstractUIFormBase form = ComponentUtils.findAncestor(command, AbstractUIFormBase.class);
-      writer.writeAttribute(DataAttributes.DEFAULT, form.getClientId(facesContext), false);
+      if (form != null) {
+        writer.writeAttribute(DataAttributes.DEFAULT, form.getClientId(facesContext), false);
+      } else {
+        LOG.warn("No from found for {}", clientId);
+      }
     }
 
     final String image = ComponentUtils.getStringAttribute(command, Attributes.image);


Mime
View raw message