You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/10/10 16:19:41 UTC

svn commit: r1396615 - in /tomcat/trunk: java/org/apache/jasper/compiler/JspReader.java test/org/apache/jasper/compiler/TestJspReader.java test/webapp-3.0/bug53986.jsp

Author: markt
Date: Wed Oct 10 14:19:40 2012
New Revision: 1396615

URL: http://svn.apache.org/viewvc?rev=1396615&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53986
Ensure current and reset Mark are always separate objects. Corrects issue with parsing JSP comments that end with "---%>".

Added:
    tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java   (with props)
    tomcat/trunk/test/webapp-3.0/bug53986.jsp   (with props)
Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java?rev=1396615&r1=1396614&r2=1396615&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java Wed Oct 10 14:19:40 2012
@@ -426,7 +426,7 @@ class JspReader {
                    if (peekChar() == limit.charAt(i)) {
                        nextChar();
                    } else {
-                       setCurrent(restart);
+                       current.init(restart, singleFile);
                        continue skip;
                    }
                }

Added: tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java?rev=1396615&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java (added)
+++ tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java Wed Oct 10 14:19:40 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jasper.compiler;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.tomcat.util.buf.ByteChunk;
+import org.junit.Test;
+
+public class TestJspReader extends TomcatBaseTest {
+
+    @Test
+    public void testBug53986() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir =
+            new File("test/webapp-3.0");
+        tomcat.addWebapp(null, "", appDir.getAbsolutePath());
+
+        tomcat.start();
+
+        ByteChunk res = getUrl("http://localhost:" + getPort() +
+                "/bug53986.jsp");
+        Assert.assertTrue(res.toString().contains("OK"));
+    }
+}

Propchange: tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/trunk/test/webapp-3.0/bug53986.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/bug53986.jsp?rev=1396615&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0/bug53986.jsp (added)
+++ tomcat/trunk/test/webapp-3.0/bug53986.jsp Wed Oct 10 14:19:40 2012
@@ -0,0 +1,22 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%--- Test comment ---%>
+<html>
+  <body>
+    <p>OK</p>
+  </body>
+</html>
\ No newline at end of file

Propchange: tomcat/trunk/test/webapp-3.0/bug53986.jsp
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org