Author: markt
Date: Wed Oct  9 14:33:39 2013
New Revision: 1530632

URL: http://svn.apache.org/r1530632
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55642
Correct logic error in Node.isLiteral() that was returning the inverse of the 
desired result when the value was an EL expression.

Added:
    tomcat/trunk/test/org/apache/jasper/compiler/TestNode.java   (with props)
    tomcat/trunk/test/webapp/bug5nnnn/bug55642a.jsp   (with props)
    tomcat/trunk/test/webapp/bug5nnnn/bug55642b.jsp   (with props)
Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Node.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Node.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Node.java?rev=1530632&r1=1530631&r2=1530632&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Node.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Node.java Wed Oct  9 14:33:39 
2013
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.jasper.compiler;
 
 import java.util.ArrayList;
@@ -2289,7 +2288,7 @@ abstract class Node implements TagConsta
          *         time.
          */
         public boolean isLiteral() {
-            return !expression && (el != null) && !namedAttribute;
+            return !expression && (el == null) && !namedAttribute;
         }
 
         /**

Added: tomcat/trunk/test/org/apache/jasper/compiler/TestNode.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestNode.java?rev=1530632&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/compiler/TestNode.java (added)
+++ tomcat/trunk/test/org/apache/jasper/compiler/TestNode.java Wed Oct  9 
14:33:39 2013
@@ -0,0 +1,51 @@
+/*
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.tomcat.util.buf.ByteChunk;
+
+public class TestNode extends TomcatBaseTest {
+
+    @Test
+    public void testJspAttributeIsLiteral() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir =
+            new File("test/webapp");
+        // app dir is relative to server home
+        tomcat.addWebapp(null, "", appDir.getAbsolutePath());
+
+        tomcat.start();
+
+        ByteChunk res = getUrl("http://localhost:"; + getPort() +
+                "/bug5nnnn/bug55642a.jsp");
+
+        String result = res.toString();
+
+        System.out.println(result);
+
+        Assert.assertTrue(
+                result.indexOf("/bug5nnnn/bug55642b.jsp?foo=bar&a=1&b=2") > 0);
+    }
+}

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

Added: tomcat/trunk/test/webapp/bug5nnnn/bug55642a.jsp
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug5nnnn/bug55642a.jsp?rev=1530632&view=auto
==============================================================================
--- tomcat/trunk/test/webapp/bug5nnnn/bug55642a.jsp (added)
+++ tomcat/trunk/test/webapp/bug5nnnn/bug55642a.jsp Wed Oct  9 14:33:39 2013
@@ -0,0 +1,21 @@
+<%--
+  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.
+  --%>
+<% request.setAttribute("target","bug55642b.jsp?foo=bar"); %>
+<jsp:forward page="${requestScope.target}">
+  <jsp:param name="a" value="1"/>
+  <jsp:param name="b" value="2"/>
+</jsp:forward>
\ No newline at end of file

Propchange: tomcat/trunk/test/webapp/bug5nnnn/bug55642a.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/trunk/test/webapp/bug5nnnn/bug55642b.jsp
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug5nnnn/bug55642b.jsp?rev=1530632&view=auto
==============================================================================
--- tomcat/trunk/test/webapp/bug5nnnn/bug55642b.jsp (added)
+++ tomcat/trunk/test/webapp/bug5nnnn/bug55642b.jsp Wed Oct  9 14:33:39 2013
@@ -0,0 +1,18 @@
+<%--
+  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.
+  --%>
+<% String qs = request.getQueryString(); %>
+<p><%= request.getRequestURL() + ( qs == null ? "" : "?" + qs) %>
\ No newline at end of file

Propchange: tomcat/trunk/test/webapp/bug5nnnn/bug55642b.jsp
------------------------------------------------------------------------------
    svn:eol-style = native



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

Reply via email to