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 2019/09/19 12:52:44 UTC

[myfaces-tobago] 02/04: Writer better debug info in the case of wrong end-tag call.

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

commit e455b076a5fc9d657ae7c80d0644b18f62721619
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Sep 19 14:18:14 2019 +0200

    Writer better debug info in the case of wrong end-tag call.
---
 .../tobago/internal/webapp/DebugResponseWriterWrapper.java  | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java
index f7e6df3..25a1e34 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java
@@ -27,7 +27,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.io.Writer;
 import java.lang.invoke.MethodHandles;
@@ -223,8 +225,15 @@ public class DebugResponseWriterWrapper extends TobagoResponseWriter {
     }
 
     if (!top.equals(name)) {
-      LOG.error("Element end with name='" + name + "' doesn't match with top element on the stack='" + top + "'.",
-          new IllegalArgumentException());
+      String uri;
+      try {
+        uri =
+            ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRequestURI();
+      } catch (Exception e) {
+        uri = null;
+      }
+      LOG.error("Element end with name='" + name + "' doesn't match with top element on the stack='" + top + "'. "
+          + " Stack='" + stack + "' URI='" + uri + "'", new IllegalArgumentException());
     }
     responseWriter.endElement(name);
   }