Details
Description
If the DOMResponseWriter runs into a DOM_HIERARCHY_ERR (DOMException) exception, nothing about the problem element is written to the logs.
Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/context/DOMResponseWriter.java
===================================================================
--- D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/context/DOMResponseWriter.java (revision 14650)
+++ D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/context/DOMResponseWriter.java (working copy)
@@ -33,18 +33,15 @@
package com.icesoft.faces.context;
-import com.icesoft.faces.application.D2DViewHandler;
-import com.icesoft.faces.application.StartupTime;
-import com.icesoft.faces.context.effects.JavascriptContext;
-import com.icesoft.faces.util.CoreUtils;
-import com.icesoft.faces.webapp.http.common.Configuration;
-import com.icesoft.jasper.Constants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import java.beans.Beans;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
@@ -55,16 +52,22 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import java.beans.Beans;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.icesoft.faces.application.D2DViewHandler;
+import com.icesoft.faces.application.StartupTime;
+import com.icesoft.faces.context.effects.JavascriptContext;
+import com.icesoft.faces.util.CoreUtils;
+import com.icesoft.faces.webapp.http.common.Configuration;
+import com.icesoft.jasper.Constants;
+
/**
* <p><strong>DOMResponseWriter</strong> is a DOM specific implementation of
* <code>javax.faces.context.ResponseWriter</code>.
@@ -184,11 +187,20 @@
throws IOException {
Node oldCursor = cursor;
Element elem = document.createElement(name);
- cursor = cursor.appendChild(elem);
if (log.isTraceEnabled()) {
log.trace("startElement() name: " + name + " elem: " + elem +
- " oldCursor: " + oldCursor + " newCursor: " + cursor);
+ " oldCursor: " + oldCursor);
}
+ try{
+ cursor = cursor.appendChild(elem);
+ }
+ catch( DOMException de ){
+ log.error("could not write element: " + elem + " oldCursor: " + oldCursor);
+ throw de;
+ }
+ if (log.isTraceEnabled()) {
+ log.trace("startElement() newCursor: " + cursor);
+ }
}
public void endElement(String name) throws IOException {
Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/context/DOMResponseWriter.java
===================================================================
--- D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/context/DOMResponseWriter.java (revision 14650)
+++ D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/context/DOMResponseWriter.java (working copy)
@@ -33,18 +33,15 @@
package com.icesoft.faces.context;
-import com.icesoft.faces.application.D2DViewHandler;
-import com.icesoft.faces.application.StartupTime;
-import com.icesoft.faces.context.effects.JavascriptContext;
-import com.icesoft.faces.util.CoreUtils;
-import com.icesoft.faces.webapp.http.common.Configuration;
-import com.icesoft.jasper.Constants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import java.beans.Beans;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
@@ -55,16 +52,22 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import java.beans.Beans;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.icesoft.faces.application.D2DViewHandler;
+import com.icesoft.faces.application.StartupTime;
+import com.icesoft.faces.context.effects.JavascriptContext;
+import com.icesoft.faces.util.CoreUtils;
+import com.icesoft.faces.webapp.http.common.Configuration;
+import com.icesoft.jasper.Constants;
+
/**
* <p><strong>DOMResponseWriter</strong> is a DOM specific implementation of
* <code>javax.faces.context.ResponseWriter</code>.
@@ -184,11 +187,20 @@
throws IOException {
Node oldCursor = cursor;
Element elem = document.createElement(name);
- cursor = cursor.appendChild(elem);
if (log.isTraceEnabled()) {
log.trace("startElement() name: " + name + " elem: " + elem +
- " oldCursor: " + oldCursor + " newCursor: " + cursor);
+ " oldCursor: " + oldCursor);
}
+ try{
+ cursor = cursor.appendChild(elem);
+ }
+ catch( DOMException de ){
+ log.error("could not write element: " + elem + " oldCursor: " + oldCursor);
+ throw de;
+ }
+ if (log.isTraceEnabled()) {
+ log.trace("startElement() newCursor: " + cursor);
+ }
}
public void endElement(String name) throws IOException {
Issue Links
- is duplicated by
-
ICE-2006 Improve logging in DOMResponseWriter
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion