[tomcat] branch 8.5.x updated (66e4aa2 -> 032f503)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch 8.5.x updated (66e4aa2 -> 032f503)

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

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


    from 66e4aa2  Code formatting. Fix indent.
     new d58a072  Remove unnecessary code. s cannot be null here
     new 0af381c  Remove unnecessary code
     new 4f106d4  Fix validation warnings
     new 763baee  Remove unnecessary code. Cannot use default package in a JSP.
     new fa993e4  Remove unnecessary code. imports never contains a null entry
     new 032f503  Remove unnecessary code. There are always at least 3 package imports,

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/jasper/compiler/Generator.java | 52 +++++++++++---------------
 test/webapp/WEB-INF/bugs.tld                   |  9 +++--
 2 files changed, 26 insertions(+), 35 deletions(-)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[tomcat] 01/06: Remove unnecessary code. s cannot be null here

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

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

commit d58a0728fcfba92f7ab30b1fbf3123e0087c01e4
Author: Mark Thomas <[hidden email]>
AuthorDate: Wed Mar 31 09:17:41 2021 +0100

    Remove unnecessary code. s cannot be null here
---
 java/org/apache/jasper/compiler/Generator.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 91c7555..633426d 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -138,22 +138,20 @@ class Generator {
      */
     static String quote(String s) {
 
-        if (s == null)
+        if (s == null) {
             return "null";
+        }
 
         return '"' + escape(s) + '"';
     }
 
     /**
-     * @param s
-     *            the input string
+     * @param s     the input string - must not be {@code null}
+     *
      * @return escaped string, per Java rule
      */
     static String escape(String s) {
 
-        if (s == null)
-            return "";
-
         StringBuilder b = new StringBuilder();
         for (int i = 0; i < s.length(); i++) {
             char c = s.charAt(i);

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[tomcat] 02/06: Remove unnecessary code

markt
In reply to this post by markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 0af381c70e57f44f53aed6a0fb1ea76eb6791cb5
Author: Mark Thomas <[hidden email]>
AuthorDate: Wed Mar 31 12:02:34 2021 +0100

    Remove unnecessary code
---
 java/org/apache/jasper/compiler/Generator.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 633426d..a6c67a2 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -255,13 +255,11 @@ class Generator {
             @Override
             public void visit(Node.CustomTag n) throws JasperException {
                 if (n.useTagPlugin()) {
-                    if (n.getAtSTag() != null) {
-                        n.getAtSTag().visit(this);
-                    }
+                    // If a custom tag is configured to use a plug-in
+                    // getAtSTag() and  getAtETag() will always be non-null
+                    n.getAtSTag().visit(this);
                     visitBody(n);
-                    if (n.getAtETag() != null) {
-                        n.getAtETag().visit(this);
-                    }
+                    n.getAtETag().visit(this);
                 } else {
                     visitBody(n);
                 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[tomcat] 03/06: Fix validation warnings

markt
In reply to this post by markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 4f106d48af341a40e7cc02e5b6e502cefc88eade
Author: Mark Thomas <[hidden email]>
AuthorDate: Wed Apr 7 09:00:58 2021 +0100

    Fix validation warnings
---
 test/webapp/WEB-INF/bugs.tld | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/webapp/WEB-INF/bugs.tld b/test/webapp/WEB-INF/bugs.tld
index ede1011..268e7ee 100644
--- a/test/webapp/WEB-INF/bugs.tld
+++ b/test/webapp/WEB-INF/bugs.tld
@@ -55,15 +55,16 @@
     <name>Bug48701c</name>
     <tag-class>org.apache.jasper.compiler.TestGenerator$Bug48701</tag-class>
     <body-content>empty</body-content>
-    <attribute>
-      <name>beanName</name>
-      <type>java.lang.String</type>
-    </attribute>
     <variable>
       <name-from-attribute>beanName</name-from-attribute>
       <variable-class>org.apache.jasper.compiler.TestGenerator.Bean</variable-class>
       <scope>AT_END</scope>
     </variable>
+    <attribute>
+      <name>beanName</name>
+      <rtexprvalue>true</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
   </tag>
   <tag>
     <name>Bug56529</name>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[tomcat] 04/06: Remove unnecessary code. Cannot use default package in a JSP.

markt
In reply to this post by markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 763baeec6ac67905f2890be5f3147ee8f25234de
Author: Mark Thomas <[hidden email]>
AuthorDate: Thu Apr 1 21:11:28 2021 +0100

    Remove unnecessary code. Cannot use default package in a JSP.
---
 java/org/apache/jasper/compiler/Generator.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index a6c67a2..745fca6 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -557,13 +557,12 @@ class Generator {
 
     /**
      * Generate preamble package name (shared by servlet and tag handler
-     * preamble generation)
+     * preamble generation). Package is always non-null as neither Servlets nor
+     * tags can use a default package.
      */
     private void genPreamblePackage(String packageName) {
-        if (packageName != null && !packageName.isEmpty()) {
-            out.printil("package " + packageName + ";");
-            out.println();
-        }
+        out.printil("package " + packageName + ";");
+        out.println();
     }
 
     /**

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[tomcat] 05/06: Remove unnecessary code. imports never contains a null entry

markt
In reply to this post by markt
This is an automated email from the ASF dual-hosted git repository.

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

commit fa993e48f5281a76e2ba9f1c3698ae0590b257c2
Author: Mark Thomas <[hidden email]>
AuthorDate: Thu Apr 1 21:22:49 2021 +0100

    Remove unnecessary code. imports never contains a null entry
---
 java/org/apache/jasper/compiler/Generator.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 745fca6..4c36b08 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -616,9 +616,6 @@ class Generator {
         Set<String> packages = new HashSet<>();
         Set<String> classes = new HashSet<>();
         for (String importName : imports) {
-            if (importName == null) {
-                continue;
-            }
             String trimmed = importName.trim();
             if (trimmed.endsWith(".*")) {
                 packages.add(trimmed.substring(0, trimmed.length() - 2));

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[tomcat] 06/06: Remove unnecessary code. There are always at least 3 package imports,

markt
In reply to this post by markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 032f503ee4fc3e27d371b4ba51b45453c97ec27c
Author: Mark Thomas <[hidden email]>
AuthorDate: Thu Apr 1 21:23:21 2021 +0100

    Remove unnecessary code. There are always at least 3 package imports,
---
 java/org/apache/jasper/compiler/Generator.java | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 4c36b08..37f2588 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -629,18 +629,16 @@ class Generator {
         out.println();
         out.printil("static {");
         out.pushIndent();
-        if (packages.size() == 0) {
-            out.printin("_jspx_imports_packages = null;");
-            out.println();
-        } else {
-            out.printin("_jspx_imports_packages = new java.util.HashSet<>();");
-            out.println();
-            for (String packageName : packages) {
-                out.printin("_jspx_imports_packages.add(\"");
-                out.print(packageName);
-                out.println("\");");
-            }
+        // Packages is never empty because o.a.j.Constants.STANDARD_IMPORTS
+        // contains 3 packages and is always added to the imports.
+        out.printin("_jspx_imports_packages = new java.util.HashSet<>();");
+        out.println();
+        for (String packageName : packages) {
+            out.printin("_jspx_imports_packages.add(\"");
+            out.print(packageName);
+            out.println("\");");
         }
+        // classes however, may be empty depending on the import declarations
         if (classes.size() == 0) {
             out.printin("_jspx_imports_classes = null;");
             out.println();

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]