[tomcat] branch master updated: Simplify code

2019-12-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 ac4998b  Simplify code
ac4998b is described below

commit ac4998b10442f542c5db510fce1ba8a6187b338e
Author: remm 
AuthorDate: Tue Dec 3 21:17:45 2019 +0100

Simplify code
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index fc61310..e9cef65 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1255,14 +1255,9 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 try {
 pool.write(from, socket, selector, writeTimeout);
-if (block) {
-// Make sure we are flushed
-do {
-if (socket.flush(true, selector, writeTimeout)) {
-break;
-}
-} while (true);
-}
+// Make sure we are flushed
+do {
+} while (!socket.flush(true, selector, writeTimeout));
 } finally {
 if (selector != null) {
 pool.put(selector);


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



[tomcat] branch master updated: Simplify code. Identified by Coverity Scan.

2019-05-22 Thread 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


The following commit(s) were added to refs/heads/master by this push:
 new 3d996c7  Simplify code. Identified by Coverity Scan.
3d996c7 is described below

commit 3d996c769ea6fbed0f44bf5fdee8edaeaa4d3c5a
Author: Mark Thomas 
AuthorDate: Wed May 22 15:34:12 2019 +0100

Simplify code. Identified by Coverity Scan.
---
 java/org/apache/jasper/compiler/JspUtil.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/compiler/JspUtil.java 
b/java/org/apache/jasper/compiler/JspUtil.java
index a3411bd..96bd538 100644
--- a/java/org/apache/jasper/compiler/JspUtil.java
+++ b/java/org/apache/jasper/compiler/JspUtil.java
@@ -296,7 +296,7 @@ public class JspUtil {
 c = double.class;
 } else if ("void".equals(type)) {
 c = void.class;
-} else if (type.indexOf('[') < 0) {
+} else {
 c = loader.loadClass(type);
 }
 


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



[tomcat] branch master updated: Simplify code, cleanup and improve comments

2019-04-30 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 de57438  Simplify code, cleanup and improve comments
de57438 is described below

commit de57438cdf06aa1dea090a7baaf4373f729d5e97
Author: remm 
AuthorDate: Tue Apr 30 15:44:08 2019 +0200

Simplify code, cleanup and improve comments
---
 java/org/apache/coyote/http2/Http2AsyncParser.java | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java 
b/java/org/apache/coyote/http2/Http2AsyncParser.java
index 3cf6d1b..92bf09f 100644
--- a/java/org/apache/coyote/http2/Http2AsyncParser.java
+++ b/java/org/apache/coyote/http2/Http2AsyncParser.java
@@ -108,25 +108,19 @@ class Http2AsyncParser extends Http2Parser {
 if (streamException) {
 swallow(streamId, payloadSize, false, payload);
 } else {
-switch (frameType) {
-case SETTINGS:
-readSettingsFrame(flags, payloadSize, payload);
-break;
-default:
-// Should never happen as the frame has been 
validated as SETTINGS
-throw new 
StreamException(sm.getString("http2Parser.processFrame.unexpectedType",
-FrameType.SETTINGS, frameType), 
Http2Error.PROTOCOL_ERROR, streamId);
-}
+readSettingsFrame(flags, payloadSize, payload);
 }
 } catch (RuntimeException | IOException | Http2Exception e) {
 error = e;
 }
+// Any extra frame is not processed yet, so put back any 
leftover data
 if (payload.hasRemaining()) {
 socketWrapper.unRead(payload);
 }
 }
-// Continue processing the intial parts of the connection
+// Finish processing the connection
 upgradeHandler.processConnectionCallback(webConnection, stream);
+// Continue reading frames
 upgradeHandler.upgradeDispatch(SocketEvent.OPEN_READ);
 }
 
@@ -166,17 +160,17 @@ class Http2AsyncParser extends Http2Parser {
 
 private class FrameCompletionHandler implements CompletionCheck, 
CompletionHandler {
 
-protected boolean parsedFrameHeader = false;
-protected boolean validated = false;
-
 private final FrameType expected;
 protected final ByteBuffer[] buffers;
+
+private boolean parsedFrameHeader = false;
+private boolean validated = false;
+private CompletionState state = null;
 protected int payloadSize;
 protected FrameType frameType;
 protected int flags;
 protected int streamId;
 protected boolean streamException = false;
-protected CompletionState state = null;
 
 private FrameCompletionHandler(FrameType expected, ByteBuffer... 
buffers) {
 this.expected = expected;


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



[tomcat] branch master updated: Simplify code

2019-03-15 Thread 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


The following commit(s) were added to refs/heads/master by this push:
 new bd6eefa  Simplify code
bd6eefa is described below

commit bd6eefaa22c7804a63c517935ae54660919829f7
Author: Mark Thomas 
AuthorDate: Fri Mar 15 13:29:04 2019 +

Simplify code
---
 java/org/apache/tomcat/util/buf/B2CConverter.java | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/buf/B2CConverter.java 
b/java/org/apache/tomcat/util/buf/B2CConverter.java
index 0d3afd7..532c209 100644
--- a/java/org/apache/tomcat/util/buf/B2CConverter.java
+++ b/java/org/apache/tomcat/util/buf/B2CConverter.java
@@ -36,11 +36,8 @@ public class B2CConverter {
 
 private static final StringManager sm = 
StringManager.getManager(B2CConverter.class);
 
-private static final CharsetCache charsetCache;
+private static final CharsetCache charsetCache = new CharsetCache();
 
-static {
-charsetCache = new CharsetCache();
-}
 
 // Protected so unit tests can use it
 protected static final int LEFTOVER_SIZE = 9;


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