W3C home > Mailing lists > Public > www-validator-cvs@w3.org > July 2007

2002/css-validator/org/w3c/css/error ErrorReportHTML.java,1.3,1.4

From: Julien Grand-Mourcel via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 13 Jul 2007 13:32:23 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1I9LFv-0003Xn-Dk@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/error
In directory hutz:/tmp/cvs-serv13393/org/w3c/css/error

Modified Files:
	ErrorReportHTML.java 
Log Message:
Adding patch to use Velocity template engine.
And some other changes...

Index: ErrorReportHTML.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/error/ErrorReportHTML.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ErrorReportHTML.java	14 Sep 2005 15:14:18 -0000	1.3
+++ ErrorReportHTML.java	13 Jul 2007 13:32:21 -0000	1.4
@@ -10,6 +10,7 @@
 import java.io.PrintWriter;
 import java.net.URL;
 
+import org.apache.velocity.exception.ResourceNotFoundException;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.Util;
 import org.xml.sax.SAXParseException;
@@ -17,81 +18,81 @@
 /**
  * ErrorReportHTML<br />
  * Created: Jul 13, 2005 2:05:51 PM<br />
- * This class is used to create an (x)html page when a URI error is thrown by the servlet
+ * This class is used to create an (x)html page when a URI error is thrown by
+ * the servlet
  */
 public class ErrorReportHTML extends ErrorReport {
 
-    //ApplContext ac;
-    String title;
-    Exception e;
+	// ApplContext ac;
+	String title;
+	Exception e;
 
-    ErrorReportHTML(ApplContext ac, String title, String output, Exception e) {
-	// ac is not used for now, but may be useful
-	//this.ac     = ac;
-	this.title  = title;
-	this.e      = e;
-    }
+	public ErrorReportHTML(ApplContext ac, String title, String output, Exception e) {
+		// ac is not used for now, but may be useful
+		// this.ac = ac;
+		this.title = title;
+		this.e = e;
+	}
 
-    /**
-     * @see org.w3c.css.error.ErrorReport#print(java.io.PrintWriter)
-     */
-    public void print(PrintWriter out) {
-	try {
-	    URL localURL = ErrorReportHTML.class.getResource("error.html");
-	    DataInputStream in = new DataInputStream(localURL.openStream());
-	    try {
-		while (true) {
-		    out.print((char) in.readUnsignedByte());
-		}
-	    } catch (EOFException eof) {
-		out.println("<h2>Target: " + Util.escapeHTML(title) + "</h2>");
-		out.println("<div class=\"error\">");
-		if (e instanceof IOException) {
-		    out.println("<p>I/O Error: ");
-		    out.println(Util.escapeHTML(e.getMessage()));
-		} else if (e instanceof SAXParseException) {
-		    SAXParseException saxe = (SAXParseException) e;
-		    out.println("<p>Please, validate your XML document"
-				+ " first!</p>");
-		    if (saxe.getLineNumber() != -1) {
-			out.print("<p>Line ");
-			out.print(saxe.getLineNumber());
-			out.println("</p>");
-		    }
-		    if (saxe.getColumnNumber() != -1) {
-			out.print("<p>Column ");
-			out.print(saxe.getColumnNumber());
-			out.print("</p>\n");
-		    }
-		    out.println("<p>" + Util.escapeHTML(e.getMessage()));
-		} else if (e instanceof NullPointerException) {
-		    out.println("<p>Oups! Internal error!</p><p>");
-		    e.printStackTrace();
-		} else {
-		    out.println(e.toString());
+	/**
+	 * @see org.w3c.css.error.ErrorReport#print(java.io.PrintWriter)
+	 */
+	public void print(PrintWriter out) {
+		try {
+			URL localURL = ErrorReportHTML.class.getResource("error.html");
+			DataInputStream in = new DataInputStream(localURL.openStream());
+			try {
+				while (true) {
+					out.print((char) in.readUnsignedByte());
+				}
+			} catch (EOFException eof) {
+				out.println("<h2>Target: " + Util.escapeHTML(title) + "</h2>");
+				out.println("<div class=\"error\">");
+				if (e instanceof ResourceNotFoundException) {
+					out.println("<p>" + e.toString() + "</p>");
+				} else if (e instanceof IOException) {
+					out.println("<p>I/O Error: ");
+					out.println(Util.escapeHTML(e.getMessage()));
+				} else if (e instanceof SAXParseException) {
+					SAXParseException saxe = (SAXParseException) e;
+					out.println("<p>Please, validate your XML document" + " first!</p>");
+					if (saxe.getLineNumber() != -1) {
+						out.print("<p>Line ");
+						out.print(saxe.getLineNumber());
+						out.println("</p>");
+					}
+					if (saxe.getColumnNumber() != -1) {
+						out.print("<p>Column ");
+						out.print(saxe.getColumnNumber());
+						out.print("</p>\n");
+					}
+					out.println("<p>" + Util.escapeHTML(e.getMessage()));
+				} else if (e instanceof NullPointerException) {
+					out.println("<p>Oups! Internal error!</p><p>");
+					e.printStackTrace();
+				} else {
+					out.println(e.toString());
+				}
+				out.println("</p></div>\n<hr />\n<p><img src='images/mwc"
+						+ "ss.gif' alt='made with CSS' /></p>\n<addres" + "s><a href='Email.html'>www-validator-css</a"
+						+ "></address>\n</body></html>");
+				out.flush();
+				/*
+				 * System.err.println("CSS Validator: request failed.");
+				 * e.printStackTrace();
+				 */
+			}
+		} catch (Exception unknown) {
+			if (out != null) {
+				out.println("org.w3c.css.servlet.CssValidator: couldn't " + "load  error file");
+				out.flush();
+			}
+			unknown.printStackTrace();
+		} finally {
+			if (out != null) {
+				out.close();
+			}
 		}
-		out.println("</p></div>\n<hr />\n<p><img src='images/mwc"
-			    + "ss.gif' alt='made with CSS' /></p>\n<addres"
-			    + "s><a href='Email.html'>www-validator-css</a"
-			    + "></address>\n</body></html>");
-		out.flush();
-		/*
-		 * System.err.println("CSS Validator: request failed.");
-		 * e.printStackTrace();
-		 */
-	    }
-	} catch (Exception unknown) {
-	    if (out != null) {
-		out.println("org.w3c.css.servlet.CssValidator: couldn't "
-			    + "load  error file");
-		out.flush();
-	    }
-	    unknown.printStackTrace();
-	} finally {
-	    if (out != null) {
-		out.close();
-	    }
 	}
-    }
 
 }
Received on Friday, 13 July 2007 13:32:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:58 GMT