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
The following commit(s) were added to refs/heads/8.5.x by this push:
new 4bce6f1 Polish. Align with 9.0.x.
4bce6f1 is described below
commit 4bce6f1af32bc352af8abe521d78163bd741fb59
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Sep 9 10:30:06 2019 +0100
Polish. Align with 9.0.x.
Spacing, Javadoc, comments.
---
.../catalina/loader/WebappClassLoaderBase.java | 2 +-
.../apache/catalina/realm/GenericPrincipal.java | 2 +-
java/org/apache/catalina/realm/JNDIRealm.java | 3 --
.../org/apache/catalina/security/SecurityUtil.java | 1 -
.../apache/catalina/tribes/group/GroupChannel.java | 1 +
.../apache/catalina/util/LifecycleMBeanBase.java | 2 -
java/org/apache/coyote/AbstractProcessor.java | 1 +
java/org/apache/coyote/Request.java | 4 +-
java/org/apache/jasper/compiler/AntCompiler.java | 1 -
java/org/apache/juli/FileHandler.java | 14 +++----
java/org/apache/tomcat/util/digester/Digester.java | 8 +---
.../apache/tomcat/util/net/SecureNioChannel.java | 49 +++++++++++++++-------
12 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 4287325..ee79208 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -325,7 +325,7 @@ public abstract class WebappClassLoaderBase extends
URLClassLoader
/**
* The bootstrap class loader used to load the JavaSE classes. In some
- * implementations this class loader is always <code>null</null> and in
+ * implementations this class loader is always <code>null</code> and in
* those cases {@link ClassLoader#getParent()} will be called recursively
on
* the system class loader and the last non-null result used.
*/
diff --git a/java/org/apache/catalina/realm/GenericPrincipal.java
b/java/org/apache/catalina/realm/GenericPrincipal.java
index 64c0d30..caaf352 100644
--- a/java/org/apache/catalina/realm/GenericPrincipal.java
+++ b/java/org/apache/catalina/realm/GenericPrincipal.java
@@ -201,7 +201,7 @@ public class GenericPrincipal implements TomcatPrincipal,
Serializable {
* role, otherwise <code>false</code>
*/
public boolean hasRole(String role) {
- if ("*".equals(role)) {// Special 2.4 role meaning everyone
+ if ("*".equals(role)) { // Special 2.4 role meaning everyone
return true;
}
if (role == null) {
diff --git a/java/org/apache/catalina/realm/JNDIRealm.java
b/java/org/apache/catalina/realm/JNDIRealm.java
index a69dd71..88ef9ce 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.catalina.realm;
import java.io.IOException;
@@ -2917,8 +2916,6 @@ public class JNDIRealm extends RealmBase {
public String getUserRoleId() {
return userRoleId;
}
-
-
}
}
diff --git a/java/org/apache/catalina/security/SecurityUtil.java
b/java/org/apache/catalina/security/SecurityUtil.java
index 4a550ea..5736ca5 100644
--- a/java/org/apache/catalina/security/SecurityUtil.java
+++ b/java/org/apache/catalina/security/SecurityUtil.java
@@ -93,7 +93,6 @@ public final class SecurityUtil{
* @param methodName the method to apply the security restriction
* @param targetObject the <code>Servlet</code> on which the method will
* be called.
- * @throws Exception an execution error occurred
*/
public static void doAsPrivilege(final String methodName,
final Servlet targetObject) throws
Exception {
diff --git a/java/org/apache/catalina/tribes/group/GroupChannel.java
b/java/org/apache/catalina/tribes/group/GroupChannel.java
index a8d5315..94759d5 100644
--- a/java/org/apache/catalina/tribes/group/GroupChannel.java
+++ b/java/org/apache/catalina/tribes/group/GroupChannel.java
@@ -71,6 +71,7 @@ public class GroupChannel extends ChannelInterceptorBase
* If set to true, the channel will start a local thread for the heart
beat.
*/
protected boolean heartbeat = true;
+
/**
* If <code>heartbeat == true</code> then how often do we want this
* heartbeat to run. default is one minute
diff --git a/java/org/apache/catalina/util/LifecycleMBeanBase.java
b/java/org/apache/catalina/util/LifecycleMBeanBase.java
index 417015d..9463291 100644
--- a/java/org/apache/catalina/util/LifecycleMBeanBase.java
+++ b/java/org/apache/catalina/util/LifecycleMBeanBase.java
@@ -52,7 +52,6 @@ public abstract class LifecycleMBeanBase extends LifecycleBase
*/
@Override
protected void initInternal() throws LifecycleException {
-
// If oname is not null then registration has already happened via
// preRegister().
if (oname == null) {
@@ -157,7 +156,6 @@ public abstract class LifecycleMBeanBase extends
LifecycleBase
try {
on = new ObjectName(name.toString());
-
Registry.getRegistry(null, null).registerComponent(obj, on, null);
} catch (MalformedObjectNameException e) {
log.warn(sm.getString("lifecycleMBeanBase.registerFail", obj,
name),
diff --git a/java/org/apache/coyote/AbstractProcessor.java
b/java/org/apache/coyote/AbstractProcessor.java
index d442142..d3f214c 100644
--- a/java/org/apache/coyote/AbstractProcessor.java
+++ b/java/org/apache/coyote/AbstractProcessor.java
@@ -93,6 +93,7 @@ public abstract class AbstractProcessor extends
AbstractProcessorLight implement
userDataHelper = new UserDataHelper(getLog());
}
+
/**
* Update the current error state to the new error state if the new error
* state is more severe than the current error state.
diff --git a/java/org/apache/coyote/Request.java
b/java/org/apache/coyote/Request.java
index 2dc2a99..1ebba0e 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -205,8 +205,8 @@ public final class Request {
return urlDecoder;
}
- // -------------------- Request data --------------------
+ // -------------------- Request data --------------------
public MessageBytes scheme() {
return schemeMB;
@@ -283,8 +283,8 @@ public final class Request {
this.localPort = port;
}
- // -------------------- encoding/type --------------------
+ // -------------------- encoding/type --------------------
/**
* Get the character encoding used for this request.
diff --git a/java/org/apache/jasper/compiler/AntCompiler.java
b/java/org/apache/jasper/compiler/AntCompiler.java
index b9c7ad4..bf2a2f8 100644
--- a/java/org/apache/jasper/compiler/AntCompiler.java
+++ b/java/org/apache/jasper/compiler/AntCompiler.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.jasper.compiler;
import java.io.ByteArrayOutputStream;
diff --git a/java/org/apache/juli/FileHandler.java
b/java/org/apache/juli/FileHandler.java
index b17ef48..0d62c92 100644
--- a/java/org/apache/juli/FileHandler.java
+++ b/java/org/apache/juli/FileHandler.java
@@ -88,10 +88,10 @@ import java.util.regex.Pattern;
* <li><code>formatter</code> - The <code>java.util.logging.Formatter</code>
* implementation class name for this Handler. Default value:
* <code>java.util.logging.SimpleFormatter</code></li>
- * <li><code>maxDays</code> - The maximum number of days to keep the log
files.
- * If the specified value is <code><=0</code> then the log files will be
kept
- * on the file system forever, otherwise they will be kept the specified
maximum
- * days. Default value: <code>-1</code>.</li>
+ * <li><code>maxDays</code> - The maximum number of days to keep the log
+ * files. If the specified value is <code><=0</code> then the log files
+ * will be kept on the file system forever, otherwise they will be kept the
+ * specified maximum days. Default value: <code>-1</code>.</li>
* </ul>
*/
public class FileHandler extends Handler {
@@ -237,8 +237,8 @@ public class FileHandler extends Handler {
/**
- * Represents a file name pattern of type {prefix}{date}{suffix}. The date
- * is YYYY-MM-DD
+ * Represents a file name pattern of type {prefix}{date}{suffix}.
+ * The date is YYYY-MM-DD
*/
private Pattern pattern;
@@ -305,7 +305,6 @@ public class FileHandler extends Handler {
}
} catch (Exception e) {
reportError(null, e, ErrorManager.WRITE_FAILURE);
- return;
}
} finally {
writerLock.readLock().unlock();
@@ -455,7 +454,6 @@ public class FileHandler extends Handler {
// Set error manager
setErrorManager(new ErrorManager());
-
}
diff --git a/java/org/apache/tomcat/util/digester/Digester.java
b/java/org/apache/tomcat/util/digester/Digester.java
index 3ba1788..59d59f0 100644
--- a/java/org/apache/tomcat/util/digester/Digester.java
+++ b/java/org/apache/tomcat/util/digester/Digester.java
@@ -241,6 +241,7 @@ public class Digester extends DefaultHandler2 {
*/
protected ArrayStack<Object> params = new ArrayStack<>();
+
/**
* The SAXParser we will use to parse the input stream.
*/
@@ -1384,13 +1385,11 @@ public class Digester extends DefaultHandler2 {
*/
@Override
public void error(SAXParseException exception) throws SAXException {
-
log.error("Parse Error at line " + exception.getLineNumber() + "
column "
+ exception.getColumnNumber() + ": " + exception.getMessage(),
exception);
if (errorHandler != null) {
errorHandler.error(exception);
}
-
}
@@ -1404,13 +1403,11 @@ public class Digester extends DefaultHandler2 {
*/
@Override
public void fatalError(SAXParseException exception) throws SAXException {
-
log.error("Parse Fatal Error at line " + exception.getLineNumber() + "
column "
+ exception.getColumnNumber() + ": " + exception.getMessage(),
exception);
if (errorHandler != null) {
errorHandler.fatalError(exception);
}
-
}
@@ -1558,7 +1555,6 @@ public class Digester extends DefaultHandler2 {
setRuleNamespaceURI(newNamespaceURI);
ruleSet.addRuleInstances(this);
setRuleNamespaceURI(oldNamespaceURI);
-
}
@@ -2001,6 +1997,4 @@ public class Digester extends DefaultHandler2 {
return new StringBuilder(out);
}
}
-
-
}
diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java
b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index 6992a63..dc8c5a0 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -140,10 +140,9 @@ public class SecureNioChannel extends NioChannel {
*/
protected boolean flush(ByteBuffer buf) throws IOException {
int remaining = buf.remaining();
- if ( remaining > 0 ) {
- int written = sc.write(buf);
- return written >= remaining;
- }else {
+ if (remaining > 0) {
+ return (sc.write(buf) >= remaining);
+ } else {
return true;
}
}
@@ -406,8 +405,18 @@ public class SecureNioChannel extends NioChannel {
IOException x = new IOException(cx);
throw x;
} finally {
- if (key!=null) try {key.cancel();} catch (Exception ignore) {}
- if (selector!=null) try {selector.close();} catch (Exception
ignore) {}
+ if (key != null) {
+ try {
+ key.cancel();
+ } catch (Exception ignore) {
+ }
+ }
+ if (selector != null) {
+ try {
+ selector.close();
+ } catch (Exception ignore) {
+ }
+ }
}
}
@@ -419,7 +428,7 @@ public class SecureNioChannel extends NioChannel {
*/
protected SSLEngineResult.HandshakeStatus tasks() {
Runnable r = null;
- while ( (r = sslEngine.getDelegatedTask()) != null) {
+ while ((r = sslEngine.getDelegatedTask()) != null) {
r.run();
}
return sslEngine.getHandshakeStatus();
@@ -443,7 +452,9 @@ public class SecureNioChannel extends NioChannel {
//set the status
handshakeStatus = result.getHandshakeStatus();
//optimization, if we do have a writable channel, write it now
- if ( doWrite ) flush(netOutBuffer);
+ if (doWrite) {
+ flush(netOutBuffer);
+ }
return result;
}
@@ -459,10 +470,12 @@ public class SecureNioChannel extends NioChannel {
//clear the buffer if we have emptied it out on data
netInBuffer.clear();
}
- if ( doread ) {
+ if (doread) {
//if we have data to read, read it
int read = sc.read(netInBuffer);
- if (read == -1) throw new
IOException(sm.getString("channel.nio.ssl.eofDuringHandshake"));
+ if (read == -1) {
+ throw new
IOException(sm.getString("channel.nio.ssl.eofDuringHandshake"));
+ }
}
SSLEngineResult result;
boolean cont = false;
@@ -503,7 +516,9 @@ public class SecureNioChannel extends NioChannel {
*/
@Override
public void close() throws IOException {
- if (closing) return;
+ if (closing) {
+ return;
+ }
closing = true;
sslEngine.closeOutbound();
@@ -566,14 +581,20 @@ public class SecureNioChannel extends NioChannel {
@Override
public int read(ByteBuffer dst) throws IOException {
//are we in the middle of closing or closed?
- if ( closing || closed) return -1;
+ if (closing || closed) {
+ return -1;
+ }
//did we finish our handshake?
- if (!handshakeComplete) throw new
IllegalStateException(sm.getString("channel.nio.ssl.incompleteHandshake"));
+ if (!handshakeComplete) {
+ throw new
IllegalStateException(sm.getString("channel.nio.ssl.incompleteHandshake"));
+ }
//read from the network
int netread = sc.read(netInBuffer);
//did we reach EOF? if so send EOF up one layer.
- if (netread == -1) return -1;
+ if (netread == -1) {
+ return -1;
+ }
//the data read
int read = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]