Catalina tester failure on JSP Document Parsing

2002-09-11 Thread Steve Downey

I'm seeing the following error on catalina's tester app, running it under 
Tomcat 5:

   [echo] - JSP Document Parsing -
   [tester] EXPECTED: ==
   [tester] 
atextb/b/aatextb/b/acdtext/d/ccdtext/d/cef/ftextf/f/eef/ftextf/f/e
   [tester] 
   [tester] RECEIVED: ==
   [tester] 
atextb//aatextb//acdtext/d/ccdtext/d/cef/textf//eef/textf//e
   [tester] 
   [tester] FAIL [GET /tester/JspDoc01.jsp HTTP/1.0] Failed Golden File 
Comparison


However, I'm not sure the test is actually correct. It's failing because of 
the empty elements being converted from b/b to b/, and from f/f to 
/f. But, under XML, those are identical ways of saying the same thing.

If my analysis is correct, then the golden text needs to be changed, and here 
is a patch for it. Otherwise, there's a deeper problem.


Index: golden/JspDoc01.txt
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/tester/web/golden/JspDoc01.txt,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 JspDoc01.txt
--- golden/JspDoc01.txt	18 Jul 2002 16:47:25 -	1.1.1.1
+++ golden/JspDoc01.txt	11 Sep 2002 22:10:51 -
@@ -1 +1 @@
-atextb/b/aatextb/b/acdtext/d/ccdtext/d/cef/ftextf/f/eef/ftextf/f/e
+atextb//aatextb//acdtext/d/ccdtext/d/cef/textf//eef/textf//e
\ No newline at end of file



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: Catalina tester failure on JSP Document Parsing

2002-09-11 Thread Kin-Man Chung

I'd suggest that we remove this test.

Jasper 2 and jasper produces different but correct XML view of the JSP
document.  If the golden file is fixed to pass in TC5, it would then
fail in TC4.0.

 Date: Wed, 11 Sep 2002 18:10:59 -0400
 From: Steve Downey [EMAIL PROTECTED]
 Subject: Catalina tester failure on JSP Document Parsing
 To: [EMAIL PROTECTED]
 
 I'm seeing the following error on catalina's tester app, running it under 
 Tomcat 5:
 
[echo] - JSP Document Parsing -
[tester] EXPECTED: ==
[tester] 
 
atextb/b/aatextb/b/acdtext/d/ccdtext/d/cef/
ftextf/f/eef/ftextf/f/e
[tester] 
[tester] RECEIVED: ==
[tester] 
 
atextb//aatextb//acdtext/d/ccdtext/d/cef/textf/
/eef/textf//e
[tester] 
[tester] FAIL [GET /tester/JspDoc01.jsp HTTP/1.0] Failed Golden File 
 Comparison
 
 
 However, I'm not sure the test is actually correct. It's failing because of 
 the empty elements being converted from b/b to b/, and from f/f to 
 /f. But, under XML, those are identical ways of saying the same thing.
 
 If my analysis is correct, then the golden text needs to be changed, and here 
 is a patch for it. Otherwise, there's a deeper problem.


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Catalina tester failure on JSP Document Parsing

2002-09-11 Thread Steve Downey

The tests for Tomcat4 are in jakarta-tomcat-4.0/tester, while the tests for 
tomcat 5 are in jakarta-tomcat-catalina/tester, so fixing them shouldn't be a 
problem in that sense.

Howver, since tomcat 4 is now shipping with jasper2, isn't it a problem for 
tomcat 4, also?

In any case, given the lack of depth in this test, I think the right answer is 
to change it to eliminate the empty tags. I think it's really trying just to 
see if JSP Document is there as a feature, not really checking the handling 
of XML.



On Wednesday 11 September 2002 06:21 pm, Kin-Man Chung wrote:
 I'd suggest that we remove this test.

 Jasper 2 and jasper produces different but correct XML view of the JSP
 document.  If the golden file is fixed to pass in TC5, it would then
 fail in TC4.0.

  Date: Wed, 11 Sep 2002 18:10:59 -0400
  From: Steve Downey [EMAIL PROTECTED]
  Subject: Catalina tester failure on JSP Document Parsing
  To: [EMAIL PROTECTED]
 
  I'm seeing the following error on catalina's tester app, running it under
  Tomcat 5:
 
 [echo] - JSP Document Parsing -
 [tester] EXPECTED: ==
 [tester]

 atextb/b/aatextb/b/acdtext/d/ccdtext/d/ce
f/ ftextf/f/eef/ftextf/f/e

 [tester] 
 [tester] RECEIVED: ==
 [tester]

 atextb//aatextb//acdtext/d/ccdtext/d/cef/te
xtf/

 /eef/textf//e
 [tester] 
 [tester] FAIL [GET /tester/JspDoc01.jsp HTTP/1.0] Failed Golden File
  Comparison
 
 
  However, I'm not sure the test is actually correct. It's failing because
  of the empty elements being converted from b/b to b/, and from
  f/f to /f. But, under XML, those are identical ways of saying the
  same thing.
 
  If my analysis is correct, then the golden text needs to be changed, and
  here is a patch for it. Otherwise, there's a deeper problem.


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: JSP Document parsing

2001-08-20 Thread Mark Abbott

Hi again - since no one voiced an opinion on the right way to 
approach this bug, I've done the simplest possible fix and attached a patch. 

This change will cause Jasper to always emit its own hardcoded values 
for the xmlns:jsp and version attributes of the jsp:root tag, ignoring any 
occurrences of those attributes in documents. This makes processing of 
JSP documents consistent whether they were specified in XML or JSP 
syntax. I also made the trivial fix to the double end tag problem.

I suspect that a more elaborate solution might be desirable for the version 
attribute, since if the document says it is version 1.3 (when we have such 
a version), but the compiler only handles 1.2, this ought to indicate a 
problem. But I'm not sure how to do that at this point, so this patch gets 
past the immediate problems that make valid documents unusable.

Cheers - Mark

Index: XmlOutputter.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v
retrieving revision 1.15
diff -u -p --unified=5 -r1.15 XmlOutputter.java
--- XmlOutputter.java   2001/07/25 01:49:10 1.15
+++ XmlOutputter.java   2001/08/20 18:14:35
@@ -126,12 +126,12 @@ public class XmlOutputter {
 void addRootAttrs(Attributes attrs) {
jspRootLevel++;
 int attrsLength = attrs.getLength();
 for (int i = 0; i  attrsLength; i++) {
String qName = attrs.getQName(i);
-   if (attrs.getQName(i).startsWith(xmlns:jsp) 
-jspRootLevel  1) continue; 
+   if ((qName.startsWith(xmlns:jsp) || 
+qName.equals(version))) continue; 
 rootAttrs.addAttribute(attrs.getURI(i), attrs.getLocalName(i),
 attrs.getQName(i), attrs.getType(i), attrs.getValue(i));
 }
 }
 
@@ -142,18 +142,15 @@ public class XmlOutputter {
 rootAttrs.addAttribute(, xmlns, xmlns: + prefix, CDATA, uri);
  }
 
 
 /*
- * Only put the /jsp:root tag when we're dealing
- * with the top level 'container' page.
+ * Don't append the root end tag here because the
+ * getPageData method will append it later.
  */
 void rootEnd() {
jspRootLevel--;
-   if (jspRootLevel == 0) {
-   append(jsp:root);
-   }
 }
 
 /**
  * Append the cdata to the XML stream.
  */



JSP Document parsing

2001-08-16 Thread Mark Abbott

Hi all -

I've noticed a couple of problems with Jasper when processing
JSP documents, that is, JSP pages authored in the XML syntax.
I'm using the tomcat-b7 release.

The documents I've tried contain explicit jsp:root elements,
as it seems they ought to.  Unfortunately, the XmlOutputter class
in Jasper, while making an effort to avoid choking on multiple
jsp:root elements encountered while processing included
pages, does not handle the case where the outermost containing
page itself contains such an element.

One result is that two /jsp:root end tags get emitted into the page.
The more subtle issue has to do with the xmlns:jsp and version
attributes on the jsp:root start tag.  Jasper inserts hardcoded values 
for those attributes corresponding to the JSP 1.2 release. But in order
to be truly valid, the document itself should contain those attributes
(at least version is required). So two instances of each attribute end up
in the output, causing the resulting XML stream to be invalid when parsed
by, for example, the tag library validator in JSPTL.

Maybe the attributes in the outermost containing page ought to
override any hardcoded defaults Jasper wants to assert? Or maybe Jasper
should report an error if the version attribute in the document doesn't agree
with the JSP version it thinks it is processing?  What do you think?
I may be able to provide diffs for a solution if I was sure what to do.

Thanks - Mark