[tomcat] branch 9.0.x updated (97e6911 -> d065ea8)

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

[tomcat] branch 9.0.x updated (97e6911 -> d065ea8)

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

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


    from 97e6911  Fix merge error
     new 41fe83f  Remove unnecessary code. s cannot be null here
     new 409a82b  Remove unnecessary code
     new 585f628  Fix validation warnings
     new 9d7a841  Remove unnecessary code. Cannot use default package in a JSP.
     new 2729360  Remove unnecessary code. imports never contains a null entry
     new d065ea8  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 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 41fe83f3605a42c614fb557567efc273ec72bc45
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 396cd91..5f9df54 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -145,22 +145,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 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 409a82b2779ca8fa37256f6e120234a1c3ded8c5
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 5f9df54..152c42a 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -262,13 +262,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 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 585f628b1a68517b16b070466571aed2ecde2d7d
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 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9d7a841d6d2381ed8462e4ede77c40a933dda3cf
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 152c42a..246cf7d 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -564,13 +564,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 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 272936054d5180c8cd13899d9a341bdebe69348d
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 246cf7d..e51ad17 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -623,9 +623,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 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit d065ea851080afc039c98fcd2b45d114cf3921da
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 e51ad17..2e6509c 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -636,18 +636,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]