You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ma...@apache.org on 2003/11/05 21:15:55 UTC
cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/view ImportSupport.java
marino 2003/11/05 12:15:55
Modified: src/java/org/apache/velocity/tools/view ImportSupport.java
Log:
improved some exception messages.
Revision Changes Path
1.4 +9 -7 jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/ImportSupport.java
Index: ImportSupport.java
===================================================================
RCS file: /home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/ImportSupport.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ImportSupport.java 30 Oct 2003 01:01:37 -0000 1.3
+++ ImportSupport.java 5 Nov 2003 20:15:55 -0000 1.4
@@ -153,7 +153,7 @@
// URL is relative, so we must be an HTTP request
if (! (request instanceof HttpServletRequest
&& response instanceof HttpServletResponse)) {
- throw new Exception("Importing a non-HTTP relative resource");
+ throw new Exception("Relative import from non-HTTP request not allowed");
}
// retrieve an appropriate ServletContext
@@ -170,7 +170,7 @@
}
// include the resource, using our custom wrapper
- ImportResponseWrapper irw =
+ ImportResponseWrapper irw =
new ImportResponseWrapper( (HttpServletResponse) response);
// spec mandates specific error handling form include()
@@ -259,10 +259,10 @@
return r;
}
catch (IOException ex) {
- throw new Exception("IMPORT_ABS_ERROR", ex);
+ throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex.toString(), ex);
}
catch (RuntimeException ex) { // because the spec makes us
- throw new Exception("IMPORT_ABS_ERROR", ex);
+ throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex.toString(), ex);
}
}
}
@@ -326,7 +326,8 @@
*/
public PrintWriter getWriter() {
if (isStreamUsed) {
- throw new IllegalStateException("IMPORT_ILLEGAL_STREAM");
+ throw new IllegalStateException("Unexpected internal error during import: "
+ + "Target servlet called getWriter(), then getOutputStream()");
}
isWriterUsed = true;
return new PrintWriter(sw);
@@ -337,7 +338,8 @@
*/
public ServletOutputStream getOutputStream() {
if (isWriterUsed) {
- throw new IllegalStateException("IMPORT_ILLEGAL_WRITER");
+ throw new IllegalStateException("Unexpected internal error during import: "
+ + "Target servlet called getOutputStream(), then getWriter()");
}
isStreamUsed = true;
return sos;
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org