[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new 9f2d784 Remove unnecessary code 9f2d784 is described below commit 9f2d78449f409ecffade937dfc7441d90ac914b3 Author: Mark Thomas AuthorDate: Tue May 11 21:49:07 2021 +0100 Remove unnecessary code This method is called for a SimpleTag. pushBodyCountVar is always null for SimpleTag as the code where it is set in visit(CustomTag) is never called if n.implementsSimpleTag() is true. --- java/org/apache/jasper/compiler/Generator.java | 4 webapps/docs/changelog.xml | 8 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 25c67ac..b34c6b7 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -3300,10 +3300,6 @@ class Generator { boolean tmpIsFragment = isFragment; isFragment = true; String pushBodyCountVarSave = pushBodyCountVar; -if (pushBodyCountVar != null) { -// Use a fixed name for push body count, to simplify code gen -pushBodyCountVar = "_jspx_push_body_count"; -} visitBody(n); out = outSave; parent = tmpParent; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 5bd018f..5babeb4 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -104,6 +104,14 @@ issues do not "pop up" wrt. others). --> + + + +Review code used to generate Java source from JSPs and tags and remove +code found to be unnecessary. (markt) + + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new 77eb2a7 Remove unnecessary code 77eb2a7 is described below commit 77eb2a72cc89b2d9dd2ca76b395f4671b2e35ac3 Author: Mark Thomas AuthorDate: Mon Apr 19 14:27:53 2021 +0100 Remove unnecessary code --- java/org/apache/jasper/compiler/Generator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 7af2ccc..0f47b54 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -1346,8 +1346,10 @@ class Generator { // and (for Java 9+) in an exported module int modifiers = bean.getModifiers(); JreCompat jreCompat = JreCompat.getInstance(); +// No need to test for being an interface here as the +// getConstructor() call above will have already failed for +// any interfaces. if (!Modifier.isPublic(modifiers) || -Modifier.isInterface(modifiers) || Modifier.isAbstract(modifiers) || !jreCompat.canAccess(null, constructor) ) { throw new Exception(Localizer.getMessage("jsp.error.invalid.bean", - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code. parent is always non-null
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 The following commit(s) were added to refs/heads/master by this push: new aec7797 Remove unnecessary code. parent is always non-null aec7797 is described below commit aec77974a09913d1440df5eb26b4aca090afc4c3 Author: Mark Thomas AuthorDate: Thu Apr 8 17:54:47 2021 +0100 Remove unnecessary code. parent is always non-null --- java/org/apache/jasper/compiler/Generator.java | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index e8ffe88..bf25b34 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -1104,12 +1104,9 @@ class Generator { * a Named Attribute (jsp:attribute), generate the code to evaluate * those bodies first. * - * If parent is null, simply returns. + * {@code parent} is assumed to be non-null */ private void prepareParams(Node parent) throws JasperException { -if (parent == null) -return; - Node.Nodes subelements = parent.getBody(); if (subelements != null) { for (int i = 0; i < subelements.size(); i++) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new adcc949 Remove unnecessary code adcc949 is described below commit adcc9495fe0158dbac72b81f5c4c6da95e9974ee Author: Mark Thomas AuthorDate: Thu Apr 8 15:50:25 2021 +0100 Remove unnecessary code Node.ELExpression instances are not created if pageInfo.isELIgnored is true. It seems likely this code predates the refactoring (many years ago) that switched to parsing in two passes. The first pass parses just the directives. The second parses everything given on the basis of the directives found in the first pass. --- java/org/apache/jasper/compiler/Generator.java | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 44227d5..e8ffe88 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -1051,16 +1051,12 @@ class Generator { @Override public void visit(Node.ELExpression n) throws JasperException { n.setBeginJavaLine(out.getJavaLine()); -if (!pageInfo.isELIgnored() && (n.getEL() != null)) { -out.printil("out.write(" -+ elInterpreter.interpreterCall(ctxt, this.isTagFile, -n.getType() + "{" + n.getText() + "}", -String.class, n.getEL().getMapName()) + -");"); -} else { -out.printil("out.write(" -+ quote(n.getType() + "{" + n.getText() + "}") + ");"); -} +System.out.println("[" + pageInfo.isELIgnored() + "] [" + n.getEL() + "]"); +out.printil("out.write(" ++ elInterpreter.interpreterCall(ctxt, this.isTagFile, +n.getType() + "{" + n.getText() + "}", +String.class, n.getEL().getMapName()) + +");"); n.setEndJavaLine(out.getJavaLine()); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new 6f0573b Remove unnecessary code 6f0573b is described below commit 6f0573b0f42f00ed23e2c2f44925fc148bfdad5b Author: Mark Thomas AuthorDate: Thu Apr 8 14:50:53 2021 +0100 Remove unnecessary code If an attribute is not a named attribute then it must appear in an XML element in the form attributeName="attributeValue". There is no way to construct such an XML attribute such that the attributeValue is null. I have also checked all the possible code paths to this method and I could not find any where an attribute that was not a named attribute could have a null value. --- 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 07de664..44227d5 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -960,9 +960,6 @@ class Generator { private String attributeValue(Node.JspAttribute attr, boolean encode, Class expectedType) { String v = attr.getValue(); -if (!attr.isNamedAttribute() && (v == null)) -return ""; - if (attr.isExpression()) { if (encode) { return "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf(" - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code.
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 The following commit(s) were added to refs/heads/master by this push: new 4b16b42 Remove unnecessary code. 4b16b42 is described below commit 4b16b429d6beac1f1c180d12d20dbb10471debd2 Author: Mark Thomas AuthorDate: Tue Mar 2 10:53:26 2021 + Remove unnecessary code. If t == null this code has no effect If t != null it is re-added in asyncConImpl.setErrorState --- java/org/apache/catalina/connector/CoyoteAdapter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java index df01fd9..8af8cd6 100644 --- a/java/org/apache/catalina/connector/CoyoteAdapter.java +++ b/java/org/apache/catalina/connector/CoyoteAdapter.java @@ -148,7 +148,6 @@ public class CoyoteAdapter implements Adapter { // trigger a close success = false; Throwable t = (Throwable)req.getAttribute(RequestDispatcher.ERROR_EXCEPTION); -req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION); Context context = request.getContext(); ClassLoader oldCL = null; try { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new 4049a74 Remove unnecessary code 4049a74 is described below commit 4049a74f0e8556b1a230858a71f2217539c674a5 Author: Mark Thomas AuthorDate: Mon Nov 23 15:44:26 2020 + Remove unnecessary code --- java/org/apache/tomcat/util/net/NioEndpoint.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 2af6dce..ab2766b 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -546,9 +546,7 @@ public class NioEndpoint extends AbstractJsseEndpoint int interestOps = pe.getInterestOps(); if (sc == null) { log.warn(sm.getString("endpoint.nio.nullSocketChannel")); -if (socketWrapper != null) { -socketWrapper.close(); -} +socketWrapper.close(); } else if (interestOps == OP_REGISTER) { try { sc.register(getSelector(), SelectionKey.OP_READ, socketWrapper); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code.
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 The following commit(s) were added to refs/heads/master by this push: new af5e746 Remove unnecessary code. af5e746 is described below commit af5e746c13b875158bb42decbe19915387983e40 Author: Mark Thomas AuthorDate: Fri Aug 14 13:04:07 2020 +0100 Remove unnecessary code. System property is no longer use to control strict whitespace parsing. No need to duplicate tests that do not depend on the setting of strict whitespace parsing. --- test/org/apache/jasper/compiler/TestParser.java| 5 +- .../compiler/TestParserNoStrictWhitespace.java | 87 +- 2 files changed, 6 insertions(+), 86 deletions(-) diff --git a/test/org/apache/jasper/compiler/TestParser.java b/test/org/apache/jasper/compiler/TestParser.java index 1e682f0..356ebab 100644 --- a/test/org/apache/jasper/compiler/TestParser.java +++ b/test/org/apache/jasper/compiler/TestParser.java @@ -23,8 +23,9 @@ import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; /** - * Tests are duplicated in {@link TestParserNoStrictWhitespace} with the strict - * whitespace parsing disabled. + * Tests that depend on strict whitespace parsing are duplicated in + * {@link TestParserNoStrictWhitespace} with the strict whitespace parsing + * disabled. */ public class TestParser extends TomcatBaseTest { diff --git a/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java b/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java index 19f9633..58d3f9f 100644 --- a/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java +++ b/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java @@ -24,83 +24,12 @@ import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; /** - * Tests are duplicated in {@link TestParser} with the strict whitespace parsing - * enabled by default. + * Tests duplicate those in {@link TestParser} where the strict whitespace + * parsing is enabled by default. Strict whitespace parsing is disabled for + * these tests in web.xml. */ public class TestParserNoStrictWhitespace extends TomcatBaseTest { -@Override -public void setUp() throws Exception { -System.setProperty( -"org.apache.jasper.compiler.Parser.STRICT_WHITESPACE", -"false"); -super.setUp(); -} - -@Test -public void testBug48627() throws Exception { -getTomcatInstanceTestWebapp(false, true); - -ByteChunk res = getUrl("http://localhost:; + getPort() + -"/test/bug48nnn/bug48627.jsp"); - -String result = res.toString(); -// Beware of the differences between escaping in JSP attributes and -// in Java Strings -assertEcho(result, "00-\\"); -assertEcho(result, "01-\\"); -} - -@Test -public void testBug48668a() throws Exception { -getTomcatInstanceTestWebapp(false, true); - -ByteChunk res = getUrl("http://localhost:; + getPort() + -"/test/bug48nnn/bug48668a.jsp"); -String result = res.toString(); -assertEcho(result, "00-Hello world#{foo.bar}"); -assertEcho(result, "01-Hello world${foo.bar}"); -assertEcho(result, "10-Hello ${'foo.bar}"); -assertEcho(result, "11-Hello ${'foo.bar}"); -assertEcho(result, "12-Hello #{'foo.bar}"); -assertEcho(result, "13-Hello #{'foo.bar}"); -assertEcho(result, "14-Hello ${'foo}"); -assertEcho(result, "15-Hello ${'foo}"); -assertEcho(result, "16-Hello #{'foo}"); -assertEcho(result, "17-Hello #{'foo}"); -assertEcho(result, "18-Hello ${'foo.bar}"); -assertEcho(result, "19-Hello ${'foo.bar}"); -assertEcho(result, "20-Hello #{'foo.bar}"); -assertEcho(result, "21-Hello #{'foo.bar}"); -assertEcho(result, "30-Hello ${'foo}"); -assertEcho(result, "31-Hello ${'foo}"); -assertEcho(result, "32-Hello #{'foo}"); -assertEcho(result, "33-Hello #{'foo}"); -assertEcho(result, "34-Hello ${'foo}"); -assertEcho(result, "35-Hello ${'foo}"); -assertEcho(result, "36-Hello #{'foo}"); -assertEcho(result, "37-Hello #{'foo}"); -assertEcho(result, "40-Hello ${'foo}"); -assertEcho(result, "41-Hello ${'foo}"); -assertEcho(result, "42-Hello #{'foo}"); -assertEcho(result, "43-Hello #{'foo}"); -assertEcho(result, "50-Hello ${'foo}"); -assertEcho(result, "51-Hello ${'foo}"); -assertEcho(result, "52-Hello #{'foo}"); -assertEcho(result, "53-Hello #{'foo}"); -} - -@Test -public void testBug48668b() throws Exception { -getTomcatInstanceTestWebapp(false, true); - -ByteChunk res = getUrl("http://localhost:; +
[tomcat] branch master updated: Remove unnecessary code. This attribute will always be set.
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 The following commit(s) were added to refs/heads/master by this push: new 133fc41 Remove unnecessary code. This attribute will always be set. 133fc41 is described below commit 133fc41b770de02fb0ea75367815ac17d7bc9a84 Author: Mark Thomas AuthorDate: Thu Jun 4 17:47:23 2020 +0100 Remove unnecessary code. This attribute will always be set. --- java/org/apache/jasper/EmbeddedServletOptions.java | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java b/java/org/apache/jasper/EmbeddedServletOptions.java index e0198c6..1758a8d 100644 --- a/java/org/apache/jasper/EmbeddedServletOptions.java +++ b/java/org/apache/jasper/EmbeddedServletOptions.java @@ -753,17 +753,9 @@ public final class EmbeddedServletOptions implements Options { if (dir != null) { scratchDir = new File(dir); } else { -// First try the Servlet 2.2 jakarta.servlet.context.tempdir property scratchDir = (File) context.getAttribute(ServletContext.TEMPDIR); -if (scratchDir == null) { -// Not running in a Servlet 2.2 container. -// Try to get the JDK 1.2 java.io.tmpdir property -dir = System.getProperty("java.io.tmpdir"); -if (dir != null) -scratchDir = new File(dir); -} } -if (this.scratchDir == null) { +if (scratchDir == null) { log.fatal(Localizer.getMessage("jsp.error.no.scratch.dir")); return; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new 4637304 Remove unnecessary code 4637304 is described below commit 4637304f3a1272c4c9d0a3dd5d4f393f99ba5cf6 Author: Mark Thomas AuthorDate: Tue Oct 29 18:49:53 2019 +0100 Remove unnecessary code --- java/org/apache/coyote/http11/Http11Processor.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index 30dd05a..6ffcd16 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -22,7 +22,6 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.regex.Pattern; @@ -211,7 +210,6 @@ public class Http11Processor extends AbstractProcessor { private void addInputFilter(InputFilter[] inputFilters, String encodingName) { // Parsing trims and converts to lower case. -encodingName = encodingName.trim().toLowerCase(Locale.ENGLISH); if (encodingName.equals("identity")) { // Skip - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Remove unnecessary code
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 The following commit(s) were added to refs/heads/master by this push: new 93b8894 Remove unnecessary code 93b8894 is described below commit 93b8894360a93c41f5c5afc406924b70a5d8c18f Author: Mark Thomas AuthorDate: Wed Aug 14 17:47:08 2019 +0100 Remove unnecessary code All currently supported versions of Windows support large pollsets --- java/org/apache/tomcat/util/net/AprEndpoint.java | 14 ++ webapps/docs/changelog.xml | 9 + 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 2075783..46c7047 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -1639,25 +1639,15 @@ public class AprEndpoint extends AbstractEndpoint implements SNICallB private volatile boolean sendfileRunning = true; /** - * Create the sendfile poller. With some versions of APR, the maximum - * poller size will be 62 (recompiling APR is necessary to remove this - * limitation). + * Create the sendfile poller. */ protected void init() { pool = Pool.create(serverSockPool); int size = sendfileSize; if (size <= 0) { -size = (OS.IS_WIN32 || OS.IS_WIN64) ? (1 * 1024) : (16 * 1024); +size = 16 * 1024; } sendfilePollset = allocatePoller(size, pool, getConnectionTimeout()); -if (sendfilePollset == 0 && size > 1024) { -size = 1024; -sendfilePollset = allocatePoller(size, pool, getConnectionTimeout()); -} -if (sendfilePollset == 0) { -size = 62; -sendfilePollset = allocatePoller(size, pool, getConnectionTimeout()); -} desc = new long[size * 2]; sendfileData = new HashMap<>(size); addS = new ArrayList<>(); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 678a821..79c3667 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -45,6 +45,15 @@ issues do not "pop up" wrt. others). --> + + + +Remove the code in the sendfile poller that ensured smaller pollsets +were used with older, no longer supported versions of Windows that +could not support larger pollsets. (markt) + + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org