[tomcat] branch master updated (d51a186 -> 27a0d77)

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

[tomcat] branch master updated (d51a186 -> 27a0d77)

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

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


    from d51a186  Update to new versions
     new 28b4b98  Remove unnecessary code. s cannot be null here
     new d96e744  Remove unnecessary code
     new 7112769  Fix validation warnings
     new afb6d44  Remove unnecessary code. Cannot use default package in a JSP.
     new 48424dc  Remove unnecessary code. imports never contains a null entry
     new 27a0d77  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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 28b4b98f522dfe311249193a25953abf4e7d2829
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 09e1053..ff79296 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -129,22 +129,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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit d96e744b3c02b05839e9ad753d4d43c95ff205e7
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 ff79296..2333063 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -246,13 +246,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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 7112769e878aacdd388f75d796d6691627f5e717
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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit afb6d44574b68954fd270c2172d23be0689198f0
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 2333063..c2f96fb 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -548,13 +548,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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 48424dc8c4108c1f561e7fd8d569dd6a61842d6f
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 c2f96fb..91d4ddc 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -607,9 +607,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 master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 27a0d770284ff54881d867c2fd9218030ca77097
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 91d4ddc..07de664 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -620,18 +620,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]