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 2021/06/25 11:47:32 UTC

[tomcat] branch 9.0.x updated: Add test case for BZ 65377

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 17c7d5f  Add test case for BZ 65377
17c7d5f is described below

commit 17c7d5f3c5a186bdc2a75f4f35aca7ad95d85ea9
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jun 25 12:45:39 2021 +0100

    Add test case for BZ 65377
    
    This test case confirms the current behaviour is the same for primitive
    and their object equivalents. It will also confirm that this is
    unchanged after the object equivalents are re-written not to use the
    deprecated constructors.
    https://bz.apache.org/bugzilla/show_bug.cgi?id=65377
---
 test/org/apache/jasper/compiler/TestJspUtil.java | 49 ++++++++++++++++++++++++
 test/webapp/bug6nnnn/bug65377.jsp                | 39 +++++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/test/org/apache/jasper/compiler/TestJspUtil.java b/test/org/apache/jasper/compiler/TestJspUtil.java
new file mode 100644
index 0000000..f7755d0
--- /dev/null
+++ b/test/org/apache/jasper/compiler/TestJspUtil.java
@@ -0,0 +1,49 @@
+/*
+ * 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 jakarta.servlet.http.HttpServletResponse;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.tomcat.util.buf.ByteChunk;
+
+public class TestJspUtil extends TomcatBaseTest {
+
+    @Test
+    public void testBoxedPrimitiveConstructors() throws Exception {
+        getTomcatInstanceTestWebapp(false, true);
+
+        ByteChunk bc = new ByteChunk();
+        int rc = getUrl("http://localhost:" + getPort() + "/test/bug6nnnn/bug65377.jsp", bc, null);
+
+        String body = bc.toString();
+        String[] lines = body.split("\n");
+
+        for (String line : lines) {
+            line = line.trim();
+            if (line.startsWith("<p>")) {
+                line = line.substring(3, line.length() - 4);
+                String[] parts = line.split(":");
+                Assert.assertEquals(parts[0],  parts[1], parts[2]);
+            }
+        }
+        Assert.assertEquals(bc.toString(), HttpServletResponse.SC_OK, rc);
+    }
+}
diff --git a/test/webapp/bug6nnnn/bug65377.jsp b/test/webapp/bug6nnnn/bug65377.jsp
new file mode 100644
index 0000000..9cb8b73
--- /dev/null
+++ b/test/webapp/bug6nnnn/bug65377.jsp
@@ -0,0 +1,39 @@
+<%--
+ 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.
+--%>
+<%@ taglib uri="http://tomcat.apache.org/tag-setters" prefix="ts" %>
+<html>
+  <head><title>Bug 65377 test case</title></head>
+  <body>
+  <p>boolean01:<ts:tagPrimitiveBoolean foo="true" />:<ts:tagBoolean foo="true" /></p>
+  <p>boolean02:<ts:tagPrimitiveBoolean foo="false" />:<ts:tagBoolean foo="false" /></p>
+  <p>boolean03:<ts:tagPrimitiveBoolean foo="" />:<ts:tagBoolean foo="" /></p>
+  <p>byte01:<ts:tagPrimitiveByte foo="12" />:<ts:tagByte foo="12" /></p>
+  <p>byte02:<ts:tagPrimitiveByte foo="" />:<ts:tagByte foo="" /></p>
+  <p>short01:<ts:tagPrimitiveShort foo="1234" />:<ts:tagShort foo="1234" /></p>
+  <p>short02:<ts:tagPrimitiveShort foo="" />:<ts:tagShort foo="" /></p>
+  <p>character01:<ts:tagPrimitiveCharacter foo="bar" />:<ts:tagCharacter foo="bar" /></p>
+  <p>character02:<ts:tagPrimitiveCharacter foo="" />:<ts:tagCharacter foo="" /></p>
+  <p>integer01:<ts:tagPrimitiveInteger foo="1234" />:<ts:tagInteger foo="1234" /></p>
+  <p>integer02:<ts:tagPrimitiveInteger foo="" />:<ts:tagInteger foo="" /></p>
+  <p>long01:<ts:tagPrimitiveLong foo="1234" />:<ts:tagLong foo="1234" /></p>
+  <p>long02:<ts:tagPrimitiveLong foo="" />:<ts:tagLong foo="" /></p>
+  <p>float01:<ts:tagPrimitiveFloat foo="12.34" />:<ts:tagFloat foo="12.34" /></p>
+  <p>float02:<ts:tagPrimitiveFloat foo="" />:<ts:tagFloat foo="" /></p>
+  <p>double01:<ts:tagPrimitiveDouble foo="12.34" />:<ts:tagDouble foo="12.34" /></p>
+  <p>double02:<ts:tagPrimitiveDouble foo="" />:<ts:tagDouble foo="" /></p>
+  </body>
+</html>
\ No newline at end of file

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