larryi 00/11/08 05:11:18
Modified: src/share/org/apache/jasper/compiler JspReader.java
JspUtil.java Parser.java
src/share/org/apache/jasper/resources messages.properties
messages_es.properties
Log:
Port Pierre Delisle's fix for the incredably unhelpful error message that occurs
for unterminated user-defined tags.
Revision Changes Path
1.21 +5 -0
jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java
Index: JspReader.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- JspReader.java 2000/09/29 07:00:28 1.20
+++ JspReader.java 2000/11/08 13:11:06 1.21
@@ -234,6 +234,11 @@
// Restore parser state:
//size--;
+ if (currFileId < 0) {
+ throw new ParseException(
+ Constants.getString("jsp.error.no.more.content"));
+ }
+
String fName = getFile(currFileId);
currFileId = unregisterSourceFile(fName);
if (currFileId < -1)
1.19 +28 -4 jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java
Index: JspUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- JspUtil.java 2000/07/07 11:59:59 1.18
+++ JspUtil.java 2000/11/08 13:11:07 1.19
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v 1.18
2000/07/07 11:59:59 rubys Exp $
- * $Revision: 1.18 $
- * $Date: 2000/07/07 11:59:59 $
+ * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v 1.19
2000/11/08 13:11:07 larryi Exp $
+ * $Revision: 1.19 $
+ * $Date: 2000/11/08 13:11:07 $
*
* ====================================================================
*
@@ -263,7 +263,31 @@
}
return escString;
}
-
+
+ /**
+ * Escape the 5 entities defined by XML.
+ */
+ public static String escapeXml(String s) {
+ if (s == null) return null;
+ StringBuffer sb = new StringBuffer();
+ for(int i=0; i<s.length(); i++) {
+ char c = s.charAt(i);
+ if (c == '<') {
+ sb.append("<");
+ } else if (c == '>') {
+ sb.append(">");
+ } else if (c == '\'') {
+ sb.append("'");
+ } else if (c == '&') {
+ sb.append("&");
+ } else if (c == '"') {
+ sb.append(""e;");
+ } else {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
public static class ValidAttribute {
String name;
1.26 +8 -1 jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Parser.java 2000/09/29 07:00:29 1.25
+++ Parser.java 2000/11/08 13:11:08 1.26
@@ -831,7 +831,14 @@
// Parse until the end of the tag body.
// Then skip the tag end...
parser.parse(tagEnd);
- reader.advance(tagEnd.length());
+ try {
+ reader.advance(tagEnd.length());
+ } catch (ParseException ex) {
+ throw new ParseException(
+ start,
+
Constants.getString("jsp.error.unterminated.user.tag",
+ new Object[]{JspUtil.escapeXml(tagEnd)}));
+ }
listener.setTemplateInfo(parser.tmplStart,
parser.tmplStop);
listener.handleTagEnd(parser.tmplStop, reader.mark(),
prefix,
shortTagName, attrs, tli, ti);
1.22 +4 -2
jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties
Index: messages.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- messages.properties 2000/07/12 17:09:00 1.21
+++ messages.properties 2000/11/08 13:11:14 1.22
@@ -1,4 +1,4 @@
-# $Id: messages.properties,v 1.21 2000/07/12 17:09:00 nacho Exp $
+# $Id: messages.properties,v 1.22 2000/11/08 13:11:14 larryi Exp $
#
# Default localized string information
# Localized this the Default Locale as is en_US
@@ -207,4 +207,6 @@
jspc.error.jasperException=error-the file ''{0}'' generated the following parse
exception: {1}
jspc.error.generalException=ERROR-the file ''{0}'' generated the following general
exception: {1}
jspc.error.fileDoesNotExist=The file argument ''{0}'' does not exist
-jspc.error.emptyWebApp=-webapp requires a trailing file argument
\ No newline at end of file
+jspc.error.emptyWebApp=-webapp requires a trailing file argument
+jsp.error.no.more.content=End of content reached while more parsing required:
unterminated tag or tag nesting error?
+jsp.error.unterminated.user.tag=Unterminated user-defined tag: ending tag {0} not
found or incorrectly nested
1.7 +3 -1
jakarta-tomcat/src/share/org/apache/jasper/resources/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/messages_es.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- messages_es.properties 2000/07/12 17:08:27 1.6
+++ messages_es.properties 2000/11/08 13:11:15 1.7
@@ -1,4 +1,4 @@
-# $Id: messages_es.properties,v 1.6 2000/07/12 17:08:27 nacho Exp $
+# $Id: messages_es.properties,v 1.7 2000/11/08 13:11:15 larryi Exp $
#
# Default localized string information
# Localized para Locale es_ES
@@ -200,3 +200,5 @@
jspc.error.generalException=ERROR-el archivo ''{0}'' ha generado la excepcion
general siguiente: {1}
jspc.error.fileDoesNotExist=El archivo ''{0}'' utilizado como argumento no existe.
jspc.error.emptyWebApp=-webapp necesita un argumento de archivo
+jsp.error.no.more.content=Final del contenido alcanzado mientras se requeria mas
entrada: anidamiento de tag s erroneo o tag no terminado
+jsp.error.unterminated.user.tag=Tag definida por el usuario no terminada: tag de
finalizacion {0} no encontrado o incorrectamente anidado
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]