(tomcat) branch 8.5.x updated: Clean-up - no functional change

2023-11-07 Thread markt
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 3dfc7aa5d8 Clean-up - no functional change
3dfc7aa5d8 is described below

commit 3dfc7aa5d897f6ae8ee8fc346b028033b2dcebb3
Author: Mark Thomas 
AuthorDate: Tue Nov 7 14:10:30 2023 +

Clean-up - no functional change
---
 .../catalina/core/ApplicationHttpRequest.java  | 63 ++
 .../apache/catalina/core/ApplicationRequest.java   | 38 ++---
 2 files changed, 19 insertions(+), 82 deletions(-)

diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java 
b/java/org/apache/catalina/core/ApplicationHttpRequest.java
index c45f895819..1f9d64dbbb 100644
--- a/java/org/apache/catalina/core/ApplicationHttpRequest.java
+++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.catalina.core;
 
-
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
@@ -51,7 +50,6 @@ import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.Parameters;
 import org.apache.tomcat.util.res.StringManager;
 
-
 /**
  * Wrapper around a javax.servlet.http.HttpServletRequest that 
transforms an application request object
  * (which might be the original one passed to a servlet, or might be based on 
the 2.3
@@ -83,29 +81,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 private static final int SPECIALS_FIRST_FORWARD_INDEX = 6;
 
 
-// --- Constructors
-
-
-/**
- * Construct a new wrapped request around the specified servlet request.
- *
- * @param request  The servlet request being wrapped
- * @param context  The target context for the wrapped request
- * @param crossContext {@code true} if the wrapped request will be a 
cross-context request, otherwise {@code false}
- */
-ApplicationHttpRequest(HttpServletRequest request, Context context, 
boolean crossContext) {
-
-super(request);
-this.context = context;
-this.crossContext = crossContext;
-setRequest(request);
-
-}
-
-
-// - Instance Variables
-
-
 /**
  * The context for this request.
  */
@@ -196,6 +171,21 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 protected final Object[] specialAttributes = new Object[specials.length];
 
 
+/**
+ * Construct a new wrapped request around the specified servlet request.
+ *
+ * @param request  The servlet request being wrapped
+ * @param context  The target context for the wrapped request
+ * @param crossContext {@code true} if the wrapped request will be a 
cross-context request, otherwise {@code false}
+ */
+ApplicationHttpRequest(HttpServletRequest request, Context context, 
boolean crossContext) {
+super(request);
+this.context = context;
+this.crossContext = crossContext;
+setRequest(request);
+}
+
+
 // - ServletRequest Methods
 
 @Override
@@ -239,7 +229,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 return specialAttributes[pos];
 }
 }
-
 }
 
 
@@ -259,11 +248,9 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
  */
 @Override
 public void removeAttribute(String name) {
-
 if (!removeSpecial(name)) {
 getRequest().removeAttribute(name);
 }
-
 }
 
 
@@ -287,7 +274,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 if (!setSpecial(name, value)) {
 getRequest().setAttribute(name, value);
 }
-
 }
 
 
@@ -352,7 +338,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 }
 
 return context.getServletContext().getRequestDispatcher(relative);
-
 }
 
 
@@ -367,7 +352,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 
 // - HttpServletRequest Methods
 
-
 /**
  * Override the getContextPath() method of the wrapped 
request.
  */
@@ -549,7 +533,6 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
 } else {
 return super.getSession(create);
 }
-
 }
 
 
@@ -630,9 +613,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
  * @param contextPath The new context path
  */
 void setContextPath(String contextPath) {
-
 this.contextPath = contextPath;
-
 }
 
 
@@ -642,9 +623,7 @@ class ApplicationHttpRequest extends 
HttpServletRequestWrapper {
  * @param pathInfo The new pat

[tomcat] branch 8.5.x updated: Clean-up. CheckStyle and formatting.

2023-05-13 Thread markt
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 508d894beb Clean-up. CheckStyle and formatting.
508d894beb is described below

commit 508d894beb3b8edb2165383457a1d4908fe7e3ba
Author: Mark Thomas 
AuthorDate: Sat May 13 12:25:19 2023 +0100

Clean-up. CheckStyle and formatting.

Fix various CheckStyle errors. Mostly Javadoc tweaks. Run the IDE
formatter to the standard formatting rules for good measure.
---
 java/org/apache/catalina/util/NetMask.java| 115 +-
 java/org/apache/catalina/util/NetMaskSet.java |  41 
 test/org/apache/catalina/util/TestNetMask.java|   5 +-
 test/org/apache/catalina/util/TestNetMaskSet.java |   4 +-
 4 files changed, 76 insertions(+), 89 deletions(-)

diff --git a/java/org/apache/catalina/util/NetMask.java 
b/java/org/apache/catalina/util/NetMask.java
index b97eee934f..a41cda1cf0 100644
--- a/java/org/apache/catalina/util/NetMask.java
+++ b/java/org/apache/catalina/util/NetMask.java
@@ -19,7 +19,6 @@ package org.apache.catalina.util;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Arrays;
-import java.util.Objects;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
@@ -27,28 +26,19 @@ import org.apache.tomcat.util.res.StringManager;
 
 /**
  * A class representing a CIDR netmask.
- *
  * 
- * The constructor takes a string as an argument which represents a netmask, as
- * per the CIDR notation -- whether this netmask be IPv4 or IPv6. It then
- * extracts the network address (before the /) and the CIDR prefix (after the
- * /), and tells through the #matches() method whether a candidate
- * {@link InetAddress} object fits in the recorded range.
+ * The constructor takes a string as an argument which represents a netmask, 
as per the CIDR notation -- whether this
+ * netmask be IPv4 or IPv6. It then extracts the network address (before the 
/) and the CIDR prefix (after the /), and
+ * tells through the #matches() method whether a candidate {@link InetAddress} 
object fits in the recorded range.
  * 
- *
  * 
- * As byte arrays as returned by InetAddress.getByName() are 
always
- * in network byte order, finding a match is therefore as simple as testing
- * whether the n first bits (where n is the CIDR) are the same in both byte
- * arrays (the one of the network address and the one of the candidate 
address).
- * We do that by first doing byte comparisons, then testing the last bits if 
any
- * (that is, if the remainder of the integer division of the CIDR by 8 is not
- * 0).
+ * As byte arrays as returned by InetAddress.getByName() are 
always in network byte order, finding a match
+ * is therefore as simple as testing whether the n first bits (where n is the 
CIDR) are the same in both byte arrays
+ * (the one of the network address and the one of the candidate address). We 
do that by first doing byte comparisons,
+ * then testing the last bits if any (that is, if the remainder of the integer 
division of the CIDR by 8 is not 0).
  * 
- *
  * 
- * As a bonus, if no '/' is found in the input, it is assumed that an exact
- * address match is required.
+ * As a bonus, if no '/' is found in the input, it is assumed that an exact 
address match is required.
  * 
  */
 public final class NetMask {
@@ -71,8 +61,7 @@ public final class NetMask {
 private final int nrBytes;
 
 /**
- * The right shift to apply to the last byte if CIDR % 8 is not 0; if it is
- * 0, this variable is set to 0
+ * The right shift to apply to the last byte if CIDR % 8 is not 0; if it 
is 0, this variable is set to 0
  */
 private final int lastByteShift;
 
@@ -91,8 +80,9 @@ public final class NetMask {
  * Constructor
  *
  * @param input the CIDR netmask
- * @throws IllegalArgumentException if the netmask is not correct (invalid
- * address specification, malformed CIDR prefix, etc)
+ *
+ * @throws IllegalArgumentException if the netmask is not correct (invalid 
address specification, malformed CIDR
+ *  prefix, etc)
  */
 public NetMask(final String input) {
 
@@ -135,8 +125,7 @@ public final class NetMask {
 }
 
 /*
- * OK, we do have a netmask specified, so let's extract both the 
address
- * and the CIDR.
+ * OK, we do have a netmask specified, so let's extract both the 
address and the CIDR.
  */
 
 final String addressPart = nonPortPart.substring(0, idx), cidrPart = 
nonPortPart.substring(idx + 1);
@@ -163,15 +152,14 @@ public final class NetMask {
 }
 
 /*
- * We don't want a negative CIDR, nor do we want a CIDR which is 
greater
- * than the address length (consider 0.0.0.0/33, 

[tomcat] branch 8.5.x updated: Clean-up, formatting. No functional change.

2023-05-05 Thread markt
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 686b81d849 Clean-up, formatting. No functional change.
686b81d849 is described below

commit 686b81d84933d85cf7be5676e0828c0554c0b9c8
Author: Mark Thomas 
AuthorDate: Fri May 5 16:46:36 2023 +0100

Clean-up, formatting. No functional change.

Preparation before back-porting RFC 9218 priorities.
---
 .../tomcat/util/http/parser/Authorization.java |  21 +-
 .../org/apache/tomcat/util/http/parser/Cookie.java |  75 
 .../apache/tomcat/util/http/parser/EntityTag.java  |  10 +-
 java/org/apache/tomcat/util/http/parser/Host.java  |  12 +-
 .../apache/tomcat/util/http/parser/HttpParser.java | 213 +
 .../apache/tomcat/util/http/parser/MediaType.java  |   6 +-
 .../tomcat/util/http/parser/MediaTypeCache.java|  13 +-
 .../apache/tomcat/util/http/parser/TokenList.java  |  22 +--
 .../apache/tomcat/util/http/parser/Upgrade.java|   2 +-
 java/org/apache/tomcat/util/http/parser/Vary.java  |   2 +-
 10 files changed, 161 insertions(+), 215 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/parser/Authorization.java 
b/java/org/apache/tomcat/util/http/parser/Authorization.java
index 8afba9bd1c..bb7b1a16e9 100644
--- a/java/org/apache/tomcat/util/http/parser/Authorization.java
+++ b/java/org/apache/tomcat/util/http/parser/Authorization.java
@@ -32,8 +32,8 @@ public class Authorization {
 static {
 // Digest field types.
 // Note: These are more relaxed than RFC2617. This adheres to the
-//   recommendation of RFC2616 that servers are tolerant of buggy
-//   clients when they can be so without ambiguity.
+// recommendation of RFC2616 that servers are tolerant of buggy
+// clients when they can be so without ambiguity.
 fieldTypes.put("username", FieldType.QUOTED_STRING);
 fieldTypes.put("realm", FieldType.QUOTED_STRING);
 fieldTypes.put("nonce", FieldType.QUOTED_STRING);
@@ -58,21 +58,18 @@ public class Authorization {
 
 
 /**
- * Parses an HTTP Authorization header for DIGEST authentication as per RFC
- * 2617 section 3.2.2.
+ * Parses an HTTP Authorization header for DIGEST authentication as per 
RFC 2617 section 3.2.2.
  *
  * @param input The header value to parse
  *
- * @return  A map of directives and values as {@link String}s or
- *  null if a parsing error occurs. Although the
- *  values returned are {@link String}s they will have been
- *  validated to ensure that they conform to RFC 2617.
+ * @return A map of directives and values as {@link String}s or 
null if a parsing error occurs.
+ * Although the values returned are {@link String}s they will 
have been validated to ensure that they
+ * conform to RFC 2617.
  *
- * @throws IllegalArgumentException If the header does not conform to RFC
- *  2617
- * @throws java.io.IOException If an error occurs while reading the input
+ * @throws IllegalArgumentException If the header does not conform to RFC 
2617
+ * @throws java.io.IOException  If an error occurs while reading the 
input
  */
-public static Map parseAuthorizationDigest (StringReader 
input)
+public static Map parseAuthorizationDigest(StringReader 
input)
 throws IllegalArgumentException, IOException {
 
 Map result = new HashMap<>();
diff --git a/java/org/apache/tomcat/util/http/parser/Cookie.java 
b/java/org/apache/tomcat/util/http/parser/Cookie.java
index 0ed7a7a3dc..33809739ed 100644
--- a/java/org/apache/tomcat/util/http/parser/Cookie.java
+++ b/java/org/apache/tomcat/util/http/parser/Cookie.java
@@ -27,35 +27,37 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Cookie header parser based on RFC6265 and RFC2109.
- * The parsing of cookies using RFC6265 is more relaxed that the
- * specification in the following ways:
+ * 
+ * Cookie header parser based on RFC6265 and RFC2109.
+ * 
+ * 
+ * The parsing of cookies using RFC6265 is more relaxed that the specification 
in the following ways:
+ * 
  * 
- *   Values 0x80 to 0xFF are permitted in cookie-octet to support the use 
of
- *   UTF-8 in cookie values as used by HTML 5.
- *   For cookies without a value, the '=' is not required after the name as
- *   some browsers do not sent it.
+ * Values 0x80 to 0xFF are permitted in cookie-octet to support the use of 
UTF-8 in cookie values as used by HTML
+ * 5.
+ * For cookies without a value, the '=' is not required after the name as 
some browsers do not sent it.
  * 
- * The parsing of cookies using RFC2109 is more relaxed that the
- * specification in the following ways:
+ * 
+ * The parsing of cookies usi

[tomcat] branch 8.5.x updated: Clean-up, formatting. No functional change.

2023-05-05 Thread markt
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 db76f15c93 Clean-up, formatting. No functional change.
db76f15c93 is described below

commit db76f15c93c6fcdfa86bcc3f70c14177967e9f01
Author: Mark Thomas 
AuthorDate: Fri May 5 16:46:12 2023 +0100

Clean-up, formatting. No functional change.

Preparation before back-porting RFC 918 priorities.
---
 java/org/apache/coyote/http2/AbstractStream.java |  4 ++--
 java/org/apache/coyote/http2/ConnectionSettingsBase.java | 10 +-
 .../org/apache/coyote/http2/ConnectionSettingsLocal.java |  2 +-
 java/org/apache/coyote/http2/HpackEncoder.java   |  8 
 java/org/apache/coyote/http2/Http2Protocol.java  |  2 +-
 java/org/apache/coyote/http2/Http2UpgradeHandler.java| 16 
 java/org/apache/coyote/http2/Stream.java | 10 +-
 java/org/apache/coyote/http2/StreamProcessor.java|  6 +++---
 8 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/coyote/http2/AbstractStream.java 
b/java/org/apache/coyote/http2/AbstractStream.java
index 2da3a63fb5..0cc5dc3e2a 100644
--- a/java/org/apache/coyote/http2/AbstractStream.java
+++ b/java/org/apache/coyote/http2/AbstractStream.java
@@ -37,8 +37,8 @@ abstract class AbstractStream {
 private final String idAsString;
 
 private volatile AbstractStream parentStream = null;
-private final Set childStreams = Collections
-.newSetFromMap(new ConcurrentHashMap());
+private final Set childStreams =
+Collections.newSetFromMap(new 
ConcurrentHashMap());
 private long windowSize = 
ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE;
 
 private volatile int connectionAllocationRequested = 0;
diff --git a/java/org/apache/coyote/http2/ConnectionSettingsBase.java 
b/java/org/apache/coyote/http2/ConnectionSettingsBase.java
index 8860a1fead..af1128be2b 100644
--- a/java/org/apache/coyote/http2/ConnectionSettingsBase.java
+++ b/java/org/apache/coyote/http2/ConnectionSettingsBase.java
@@ -45,8 +45,8 @@ abstract class ConnectionSettingsBase {
 static final int DEFAULT_MAX_FRAME_SIZE = MIN_MAX_FRAME_SIZE;
 static final long DEFAULT_MAX_HEADER_LIST_SIZE = 1 << 15;
 
-Map current = new ConcurrentHashMap<>();
-Map pending = new ConcurrentHashMap<>();
+Map current = new ConcurrentHashMap<>();
+Map pending = new ConcurrentHashMap<>();
 
 
 ConnectionSettingsBase(String connectionId) {
@@ -203,9 +203,9 @@ abstract class ConnectionSettingsBase {
 
 private void validateMaxFrameSize(long maxFrameSize) throws T {
 if (maxFrameSize < MIN_MAX_FRAME_SIZE || maxFrameSize > 
MAX_MAX_FRAME_SIZE) {
-String msg = 
sm.getString("connectionSettings.maxFrameSizeInvalid", connectionId,
-Long.toString(maxFrameSize), 
Integer.toString(MIN_MAX_FRAME_SIZE),
-Integer.toString(MAX_MAX_FRAME_SIZE));
+String msg =
+sm.getString("connectionSettings.maxFrameSizeInvalid", 
connectionId, Long.toString(maxFrameSize),
+Integer.toString(MIN_MAX_FRAME_SIZE), 
Integer.toString(MAX_MAX_FRAME_SIZE));
 throwException(msg, Http2Error.PROTOCOL_ERROR);
 }
 }
diff --git a/java/org/apache/coyote/http2/ConnectionSettingsLocal.java 
b/java/org/apache/coyote/http2/ConnectionSettingsLocal.java
index 8fecf37136..372be80223 100644
--- a/java/org/apache/coyote/http2/ConnectionSettingsLocal.java
+++ b/java/org/apache/coyote/http2/ConnectionSettingsLocal.java
@@ -61,7 +61,7 @@ class ConnectionSettingsLocal extends 
ConnectionSettingsBase setting : pending.entrySet()) {
+for (Map.Entry setting : pending.entrySet()) {
 ByteUtil.setTwoBytes(result, pos, setting.getKey().getId());
 pos += 2;
 ByteUtil.setFourBytes(result, pos, setting.getValue().longValue());
diff --git a/java/org/apache/coyote/http2/HpackEncoder.java 
b/java/org/apache/coyote/http2/HpackEncoder.java
index 4b51fbe8a6..34f90e70f9 100644
--- a/java/org/apache/coyote/http2/HpackEncoder.java
+++ b/java/org/apache/coyote/http2/HpackEncoder.java
@@ -76,14 +76,14 @@ class HpackEncoder {
 private int newMaxHeaderSize = -1; // if the max header size has been 
changed
 private int minNewMaxHeaderSize = -1; // records the smallest value of 
newMaxHeaderSize, as per section 4.1
 
-private static final Map ENCODING_STATIC_TABLE;
+private static final Map ENCODING_STATIC_TABLE;
 
 private final Deque evictionQueue = new ArrayDeque<>();
-private final Map> dynamicTable = new 
HashMap<>(); // TODO: use a custom data structure to
-   
 // reduce allocations
+private final Map> dynamicT

[tomcat] branch 8.5.x updated: Clean-up / improve naming. No functional change.

2022-09-08 Thread markt
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 27cbe3dcae Clean-up / improve naming. No functional change.
27cbe3dcae is described below

commit 27cbe3dcaefd823d2d91247fe01c0a745fbb1700
Author: Mark Thomas 
AuthorDate: Thu Sep 8 19:38:40 2022 +0100

Clean-up / improve naming. No functional change.
---
 .../org/apache/tomcat/websocket/Authenticator.java | 44 --
 .../tomcat/websocket/BasicAuthenticator.java   | 16 
 .../tomcat/websocket/DigestAuthenticator.java  | 23 ++-
 3 files changed, 43 insertions(+), 40 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Authenticator.java 
b/java/org/apache/tomcat/websocket/Authenticator.java
index bc14d5792f..aacbdb47f0 100644
--- a/java/org/apache/tomcat/websocket/Authenticator.java
+++ b/java/org/apache/tomcat/websocket/Authenticator.java
@@ -22,50 +22,54 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * Base class for the authentication methods used by the websocket client.
+ * Base class for the authentication methods used by the WebSocket client.
  */
 public abstract class Authenticator {
-private static final Pattern pattern = Pattern
-.compile("(\\w+)\\s*=\\s*(\"([^\"]+)\"|([^,=\"]+))\\s*,?");
+
+private static final Pattern pattern = 
Pattern.compile("(\\w+)\\s*=\\s*(\"([^\"]+)\"|([^,=\"]+))\\s*,?");
 
 /**
- * Generate the authentication header that will be sent to the server.
- * @param requestUri The request URI
- * @param WWWAuthenticate The server auth challenge
- * @param UserProperties The user information
- * @return The auth header
+ * Generate the authorization header value that will be sent to the server.
+ *
+ * @param requestUri The request URI
+ * @param authenticateHeader The server authentication header received
+ * @param userProperties The user information
+ *
+ * @return The generated authorization header value
+ *
  * @throws AuthenticationException When an error occurs
  */
-public abstract String getAuthorization(String requestUri, String 
WWWAuthenticate,
-Map UserProperties) throws AuthenticationException;
+public abstract String getAuthorization(String requestUri, String 
authenticateHeader,
+Map userProperties) throws AuthenticationException;
 
 /**
  * Get the authentication method.
- * @return the auth scheme
+ *
+ * @return the authentication scheme
  */
 public abstract String getSchemeName();
 
 /**
  * Utility method to parse the authentication header.
- * @param WWWAuthenticate The server auth challenge
- * @return the parsed header
+ *
+ * @param authenticateHeader The server authenticate header received
+ *
+ * @return a map of authentication parameter names and values
  */
-public Map parseWWWAuthenticateHeader(String 
WWWAuthenticate) {
+public Map parseWWWAuthenticateHeader(String 
authenticateHeader) {
 
-Matcher m = pattern.matcher(WWWAuthenticate);
-Map challenge = new HashMap<>();
+Matcher m = pattern.matcher(authenticateHeader);
+Map parameterMap = new HashMap<>();
 
 while (m.find()) {
 String key = m.group(1);
 String qtedValue = m.group(3);
 String value = m.group(4);
 
-challenge.put(key, qtedValue != null ? qtedValue : value);
+parameterMap.put(key, qtedValue != null ? qtedValue : value);
 
 }
 
-return challenge;
-
+return parameterMap;
 }
-
 }
diff --git a/java/org/apache/tomcat/websocket/BasicAuthenticator.java 
b/java/org/apache/tomcat/websocket/BasicAuthenticator.java
index 13a25e22de..07b583004f 100644
--- a/java/org/apache/tomcat/websocket/BasicAuthenticator.java
+++ b/java/org/apache/tomcat/websocket/BasicAuthenticator.java
@@ -23,7 +23,7 @@ import java.util.Map;
 import org.apache.tomcat.util.codec.binary.Base64;
 
 /**
- * Authenticator supporting the BASIC auth method.
+ * Authenticator supporting the BASIC authentication method.
  */
 public class BasicAuthenticator extends Authenticator {
 
@@ -31,24 +31,24 @@ public class BasicAuthenticator extends Authenticator {
 public static final String charsetparam = "charset";
 
 @Override
-public String getAuthorization(String requestUri, String WWWAuthenticate,
+public String getAuthorization(String requestUri, String 
authenticateHeader,
 Map userProperties) throws AuthenticationException 
{
 
 String userName = (String) 
userProperties.get(Constants.WS_AUTHENTICATION_USER_NAME);
-String password = (String) 
userProperties.get(Constants.WS_AUTHENTICATION_PASSWORD);
+String userPassword = (String) 
use

[tomcat] branch 8.5.x updated: Clean-up - no functional change

2022-08-22 Thread markt
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 2e899f9e5f Clean-up - no functional change
2e899f9e5f is described below

commit 2e899f9e5f7eadfa8a533c9b308763ad815bae50
Author: Mark Thomas 
AuthorDate: Mon Aug 22 13:52:41 2022 +0100

Clean-up - no functional change
---
 java/org/apache/catalina/ha/session/DeltaSession.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java 
b/java/org/apache/catalina/ha/session/DeltaSession.java
index efc31a78e5..91725fd8b8 100644
--- a/java/org/apache/catalina/ha/session/DeltaSession.java
+++ b/java/org/apache/catalina/ha/session/DeltaSession.java
@@ -807,8 +807,8 @@ public class DeltaSession extends StandardSession 
implements Externalizable,Clus
 }
 }
 
-//  HttpSession Private Methods
 
+//  HttpSession Private Methods
 
 /**
  * Read a serialized version of this session object from the specified
@@ -847,7 +847,6 @@ public class DeltaSession extends StandardSession 
implements Externalizable,Clus
 principal = (Principal) stream.readObject();
 }
 
-//setId((String) stream.readObject());
 id = (String) stream.readObject();
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("deltaSession.readSession", id));


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



[tomcat] branch 8.5.x updated: Clean-up. No functional change.

2022-08-21 Thread markt
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 9e1830342e Clean-up. No functional change.
9e1830342e is described below

commit 9e1830342e36b245582356e82f013a7a337e8ccc
Author: Mark Thomas 
AuthorDate: Sun Aug 21 17:06:13 2022 +0100

Clean-up. No functional change.
---
 java/org/apache/catalina/authenticator/SavedRequest.java | 2 --
 1 file changed, 2 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/SavedRequest.java 
b/java/org/apache/catalina/authenticator/SavedRequest.java
index 1473b74b9a..e13fa591c6 100644
--- a/java/org/apache/catalina/authenticator/SavedRequest.java
+++ b/java/org/apache/catalina/authenticator/SavedRequest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.catalina.authenticator;
 
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -29,7 +28,6 @@ import javax.servlet.http.Cookie;
 
 import org.apache.tomcat.util.buf.ByteChunk;
 
-
 /**
  * Object that saves the critical information from a request so that
  * form-based authentication can reproduce it once the user has been


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



[tomcat] branch 8.5.x updated: Clean-up. No functional change.

2022-05-09 Thread markt
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 7ce1b4cfb3 Clean-up. No functional change.
7ce1b4cfb3 is described below

commit 7ce1b4cfb3ab2c0340f6282a0aeed7b3bcf31b80
Author: Mark Thomas 
AuthorDate: Wed Mar 30 11:58:32 2022 +0100

Clean-up. No functional change.
---
 java/org/apache/naming/factory/BeanFactory.java| 96 +++---
 .../apache/naming/factory/LocalStrings.properties  |  5 ++
 2 files changed, 33 insertions(+), 68 deletions(-)

diff --git a/java/org/apache/naming/factory/BeanFactory.java 
b/java/org/apache/naming/factory/BeanFactory.java
index 6bf93528b2..7a42991b05 100644
--- a/java/org/apache/naming/factory/BeanFactory.java
+++ b/java/org/apache/naming/factory/BeanFactory.java
@@ -35,6 +35,7 @@ import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
 
 import org.apache.naming.ResourceRef;
+import org.apache.naming.StringManager;
 
 /**
  * Object factory for any Resource conforming to the JavaBean spec.
@@ -87,23 +88,9 @@ import org.apache.naming.ResourceRef;
  *
  * @author Aner Perez [aner at ncstech.com]
  */
-public class BeanFactory
-implements ObjectFactory {
-
-// --- Constructors
-
-
-// -- Constants
-
-
-// - Instance Variables
-
-
-// - Public Methods
-
-
-// -- ObjectFactory Methods
+public class BeanFactory implements ObjectFactory {
 
+private static final StringManager sm = 
StringManager.getManager(BeanFactory.class);
 
 /**
  * Create a new Bean instance.
@@ -111,34 +98,26 @@ public class BeanFactory
  * @param obj The reference object describing the Bean
  */
 @Override
-public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-Hashtable environment)
-throws NamingException {
+public Object getObjectInstance(Object obj, Name name, Context nameCtx, 
Hashtable environment)
+throws NamingException {
 
 if (obj instanceof ResourceRef) {
 
 try {
-
 Reference ref = (Reference) obj;
 String beanClassName = ref.getClassName();
 Class beanClass = null;
-ClassLoader tcl =
-Thread.currentThread().getContextClassLoader();
-if (tcl != null) {
-try {
+ClassLoader tcl = 
Thread.currentThread().getContextClassLoader();
+try {
+if (tcl != null) {
 beanClass = tcl.loadClass(beanClassName);
-} catch(ClassNotFoundException e) {
-}
-} else {
-try {
+} else {
 beanClass = Class.forName(beanClassName);
-} catch(ClassNotFoundException e) {
-e.printStackTrace();
 }
-}
-if (beanClass == null) {
-throw new NamingException
-("Class not found: " + beanClassName);
+} catch(ClassNotFoundException cnfe) {
+NamingException ne = new 
NamingException(sm.getString("beanFactory.classNotFound", beanClassName));
+ne.initCause(cnfe);
+throw ne;
 }
 
 BeanInfo bi = Introspector.getBeanInfo(beanClass);
@@ -174,8 +153,7 @@ public class BeanFactory
  param.substring(1);
 }
 try {
-forced.put(param,
-   beanClass.getMethod(setterName, 
paramTypes));
+forced.put(param, beanClass.getMethod(setterName, 
paramTypes));
 } catch (NoSuchMethodException|SecurityException ex) {
 throw new NamingException
 ("Forced String setter " + setterName +
@@ -219,7 +197,7 @@ public class BeanFactory
 }
 
 int i = 0;
-for (i = 0; i

[tomcat] branch 8.5.x updated: Clean-up. No functional change.

2021-07-28 Thread markt
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 f6f8ad3  Clean-up. No functional change.
f6f8ad3 is described below

commit f6f8ad3d3dce96c755671fab5268b5f1d0268a17
Author: Mark Thomas 
AuthorDate: Wed Jul 28 11:28:10 2021 +0100

Clean-up. No functional change.
---
 .../tomcat/util/net/openssl/OpenSSLContext.java| 53 +++---
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java 
b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
index 8110ff1..5fc4db9 100644
--- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
+++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
@@ -66,45 +66,33 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
 
 private static final String defaultProtocol = "TLS";
 
-private final SSLHostConfig sslHostConfig;
-private final SSLHostConfigCertificate certificate;
-private OpenSSLSessionContext sessionContext;
-private X509TrustManager x509TrustManager;
-
-private final List negotiableProtocols;
-
-private String enabledProtocol;
-
-public String getEnabledProtocol() {
-return enabledProtocol;
-}
+private static final String BEGIN_KEY = "-BEGIN PRIVATE KEY-\n";
+private static final Object END_KEY = "\n-END PRIVATE KEY-";
 
-public void setEnabledProtocol(String protocol) {
-enabledProtocol = (protocol == null) ? defaultProtocol : protocol;
+static final CertificateFactory X509_CERT_FACTORY;
+static {
+try {
+X509_CERT_FACTORY = CertificateFactory.getInstance("X.509");
+} catch (CertificateException e) {
+throw new 
IllegalStateException(sm.getString("openssl.X509FactoryError"), e);
+}
 }
 
+private final SSLHostConfig sslHostConfig;
+private final SSLHostConfigCertificate certificate;
+private final List negotiableProtocols;
 private final long aprPool;
 private final AtomicInteger aprPoolDestroyed = new AtomicInteger(0);
-
 // OpenSSLConfCmd context
 protected final long cctx;
 // SSL context
 protected final long ctx;
 
-static final CertificateFactory X509_CERT_FACTORY;
-
-private static final String BEGIN_KEY = "-BEGIN PRIVATE KEY-\n";
-
-private static final Object END_KEY = "\n-END PRIVATE KEY-";
+private OpenSSLSessionContext sessionContext;
+private X509TrustManager x509TrustManager;
+private String enabledProtocol;
 private boolean initialized = false;
 
-static {
-try {
-X509_CERT_FACTORY = CertificateFactory.getInstance("X.509");
-} catch (CertificateException e) {
-throw new 
IllegalStateException(sm.getString("openssl.X509FactoryError"), e);
-}
-}
 
 public OpenSSLContext(SSLHostConfigCertificate certificate, List 
negotiableProtocols)
 throws SSLException {
@@ -183,6 +171,17 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
 }
 }
 
+
+public String getEnabledProtocol() {
+return enabledProtocol;
+}
+
+
+public void setEnabledProtocol(String protocol) {
+enabledProtocol = (protocol == null) ? defaultProtocol : protocol;
+}
+
+
 @Override
 public synchronized void destroy() {
 // Guard against multiple destroyPools() calls triggered by 
construction exception and finalize() later

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



[tomcat] branch 8.5.x updated: Clean-up. Fix indents.

2021-06-03 Thread markt
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 0704475  Clean-up. Fix indents.
0704475 is described below

commit 0704475028478757eb31578e2b9fe24dbd0da8da
Author: Mark Thomas 
AuthorDate: Thu Jun 3 16:52:16 2021 +0100

Clean-up. Fix indents.
---
 java/javax/servlet/http/HttpServlet.java | 26 +-
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/java/javax/servlet/http/HttpServlet.java 
b/java/javax/servlet/http/HttpServlet.java
index 49d77e8..1b252a2 100644
--- a/java/javax/servlet/http/HttpServlet.java
+++ b/java/javax/servlet/http/HttpServlet.java
@@ -87,10 +87,8 @@ public abstract class HttpServlet extends GenericServlet {
 private static final String HEADER_IFMODSINCE = "If-Modified-Since";
 private static final String HEADER_LASTMOD = "Last-Modified";
 
-private static final String LSTRING_FILE =
-"javax.servlet.http.LocalStrings";
-private static final ResourceBundle lStrings =
-ResourceBundle.getBundle(LSTRING_FILE);
+private static final String LSTRING_FILE = 
"javax.servlet.http.LocalStrings";
+private static final ResourceBundle lStrings = 
ResourceBundle.getBundle(LSTRING_FILE);
 
 
 /**
@@ -423,13 +421,9 @@ public abstract class HttpServlet extends GenericServlet {
 Method[] thisMethods = c.getDeclaredMethods();
 
 if ((parentMethods != null) && (parentMethods.length > 0)) {
-Method[] allMethods =
-new Method[parentMethods.length + thisMethods.length];
-System.arraycopy(parentMethods, 0, allMethods, 0,
- parentMethods.length);
-System.arraycopy(thisMethods, 0, allMethods, parentMethods.length,
- thisMethods.length);
-
+Method[] allMethods = new Method[parentMethods.length + 
thisMethods.length];
+System.arraycopy(parentMethods, 0, allMethods, 0, 
parentMethods.length);
+System.arraycopy(thisMethods, 0, allMethods, parentMethods.length, 
thisMethods.length);
 thisMethods = allMethods;
 }
 
@@ -593,8 +587,8 @@ public abstract class HttpServlet extends GenericServlet {
 int responseLength;
 
 String CRLF = "\r\n";
-StringBuilder buffer = new StringBuilder("TRACE 
").append(req.getRequestURI())
-.append(" ").append(req.getProtocol());
+StringBuilder buffer =
+new StringBuilder("TRACE 
").append(req.getRequestURI()).append(" ").append(req.getProtocol());
 
 Enumeration reqHeaderEnum = req.getHeaderNames();
 
@@ -864,10 +858,8 @@ class NoBodyResponse extends HttpServletResponseWrapper {
 // file private
 class NoBodyOutputStream extends ServletOutputStream {
 
-private static final String LSTRING_FILE =
-"javax.servlet.http.LocalStrings";
-private static final ResourceBundle lStrings =
-ResourceBundle.getBundle(LSTRING_FILE);
+private static final String LSTRING_FILE = 
"javax.servlet.http.LocalStrings";
+private static final ResourceBundle lStrings = 
ResourceBundle.getBundle(LSTRING_FILE);
 
 private final HttpServletResponse response;
 private boolean flushed = false;

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



[tomcat] branch 8.5.x updated: Clean up

2021-05-27 Thread markt
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 3c0dd7b  Clean up
3c0dd7b is described below

commit 3c0dd7b9c8b0edf1c66590f08b1d3f644fc70bb9
Author: Mark Thomas 
AuthorDate: Thu May 27 16:22:23 2021 +0100

Clean up
---
 java/javax/annotation/sql/DataSourceDefinition.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/javax/annotation/sql/DataSourceDefinition.java 
b/java/javax/annotation/sql/DataSourceDefinition.java
index 3d4cd7e..a779b21 100644
--- a/java/javax/annotation/sql/DataSourceDefinition.java
+++ b/java/javax/annotation/sql/DataSourceDefinition.java
@@ -117,5 +117,4 @@ public @interface DataSourceDefinition {
  * @return the login timeout
  */
 int loginTimeout() default 0;
-
 }

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



[tomcat] branch 8.5.x updated: Clean-up. Align 8.5.x with master/9.0.x.

2020-01-21 Thread markt
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 43c889e  Clean-up. Align 8.5.x with master/9.0.x.
43c889e is described below

commit 43c889edbbd9b09d7df0678d7f908db7534fbaaa
Author: Mark Thomas 
AuthorDate: Tue Jan 21 16:22:28 2020 +

Clean-up. Align 8.5.x with master/9.0.x.
---
 .../org/apache/coyote/ajp/AbstractAjpProtocol.java | 38 +
 .../coyote/http11/AbstractHttp11Protocol.java  | 97 +-
 .../apache/coyote/http11/Http11InputBuffer.java|  7 +-
 java/org/apache/coyote/http11/Http11Processor.java |  1 -
 java/org/apache/tomcat/util/http/MimeHeaders.java  |  5 +-
 .../apache/tomcat/util/http/parser/HttpParser.java | 32 +++
 .../util/http/parser/LocalStrings.properties   |  8 +-
 .../util/http/parser/LocalStrings_fr.properties|  7 ++
 .../util/http/parser/LocalStrings_ja.properties|  7 ++
 .../util/http/parser/LocalStrings_ko.properties|  7 ++
 .../util/http/parser/LocalStrings_zh_CN.properties |  7 ++
 webapps/docs/config/ajp.xml|  4 +-
 webapps/docs/config/http.xml   |  4 +-
 13 files changed, 159 insertions(+), 65 deletions(-)

diff --git a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java 
b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
index 46bf9d7..872dbe6 100644
--- a/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
+++ b/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
@@ -93,50 +93,58 @@ public abstract class AbstractAjpProtocol extends 
AbstractProtocol {
 // - AJP specific 
properties
 // -- managed in the 
ProtocolHandler
 
-/**
- * Send AJP flush packet when flushing.
- * An flush packet is a zero byte AJP13 SEND_BODY_CHUNK
- * packet. mod_jk and mod_proxy_ajp interprete this as
- * a request to flush data to the client.
- * AJP always does flush at the and of the response, so if
- * it is not important, that the packets get streamed up to
- * the client, do not use extra flush packets.
- * For compatibility and to stay on the safe side, flush
- * packets are enabled by default.
- */
 protected boolean ajpFlush = true;
 public boolean getAjpFlush() { return ajpFlush; }
+/**
+ * Configure whether to aend an AJP flush packet when flushing. A flush
+ * packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and
+ * mod_proxy_ajp interpret this as a request to flush data to the client.
+ * AJP always does flush at the and of the response, so if it is not
+ * important, that the packets get streamed up to the client, do not use
+ * extra flush packets. For compatibility and to stay on the safe side,
+ * flush packets are enabled by default.
+ *
+ * @param ajpFlush  The new flush setting
+ */
 public void setAjpFlush(boolean ajpFlush) {
 this.ajpFlush = ajpFlush;
 }
 
 
+private boolean tomcatAuthentication = true;
 /**
  * Should authentication be done in the native web server layer,
  * or in the Servlet container ?
+ *
+ * @return {@code true} if authentication should be performed by Tomcat,
+ * otherwise {@code false}
  */
-private boolean tomcatAuthentication = true;
 public boolean getTomcatAuthentication() { return tomcatAuthentication; }
 public void setTomcatAuthentication(boolean tomcatAuthentication) {
 this.tomcatAuthentication = tomcatAuthentication;
 }
 
 
+private boolean tomcatAuthorization = false;
 /**
  * Should authentication be done in the native web server layer and
  * authorization in the Servlet container?
+ *
+ * @return {@code true} if authorization should be performed by Tomcat,
+ * otherwise {@code false}
  */
-private boolean tomcatAuthorization = false;
 public boolean getTomcatAuthorization() { return tomcatAuthorization; }
 public void setTomcatAuthorization(boolean tomcatAuthorization) {
 this.tomcatAuthorization = tomcatAuthorization;
 }
 
 
+private String requiredSecret = null;
 /**
- * Required secret.
+ * Set the required secret that must be included with every request.
+ *
+ * @param requiredSecret The required secret
  */
-private String requiredSecret = null;
 public void setRequiredSecret(String requiredSecret) {
 this.requiredSecret = requiredSecret;
 }
diff --git a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java 
b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
index 599b0eb..5332f9b 100644
--- a/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
+++ b/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
@@ -64,6 +64,9 @@ publi

[tomcat] branch 8.5.x updated: Clean-up. Remove unnecessary toString(). Better local variable name.

2019-12-02 Thread markt
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 2661918  Clean-up. Remove unnecessary toString(). Better local 
variable name.
2661918 is described below

commit 26619183c9318064c0ca4568281a422a211eccea
Author: Mark Thomas 
AuthorDate: Mon Dec 2 20:55:14 2019 +

Clean-up. Remove unnecessary toString(). Better local variable name.
---
 java/org/apache/catalina/realm/CombinedRealm.java | 21 -
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/realm/CombinedRealm.java 
b/java/org/apache/catalina/realm/CombinedRealm.java
index cd64d99..893c245 100644
--- a/java/org/apache/catalina/realm/CombinedRealm.java
+++ b/java/org/apache/catalina/realm/CombinedRealm.java
@@ -355,22 +355,18 @@ public class CombinedRealm extends RealmBase {
 public Principal authenticate(GSSContext gssContext, boolean storeCred) {
 if (gssContext.isEstablished()) {
 Principal authenticatedUser = null;
-String username = null;
-
-GSSName name = null;
+GSSName gssName = null;
 try {
-name = gssContext.getSrcName();
+gssName = gssContext.getSrcName();
 } catch (GSSException e) {
 log.warn(sm.getString("realmBase.gssNameFail"), e);
 return null;
 }
 
-username = name.toString();
-
 for (Realm realm : realms) {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("combinedRealm.authStart",
-username, realm.getClass().getName()));
+gssName, realm.getClass().getName()));
 }
 
 authenticatedUser = realm.authenticate(gssContext, storeCred);
@@ -378,12 +374,12 @@ public class CombinedRealm extends RealmBase {
 if (authenticatedUser == null) {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("combinedRealm.authFail",
-username, realm.getClass().getName()));
+gssName, realm.getClass().getName()));
 }
 } else {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("combinedRealm.authSuccess",
-username, realm.getClass().getName()));
+gssName, realm.getClass().getName()));
 }
 break;
 }
@@ -401,12 +397,11 @@ public class CombinedRealm extends RealmBase {
 @Override
 public Principal authenticate(GSSName gssName, GSSCredential 
gssCredential) {
 Principal authenticatedUser = null;
-String username = gssName.toString();
 
 for (Realm realm : realms) {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("combinedRealm.authStart",
-username, realm.getClass().getName()));
+gssName, realm.getClass().getName()));
 }
 
 if (!(realm instanceof GSSRealm)) {
@@ -423,12 +418,12 @@ public class CombinedRealm extends RealmBase {
 if (authenticatedUser == null) {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("combinedRealm.authFail",
-username, realm.getClass().getName()));
+gssName, realm.getClass().getName()));
 }
 } else {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("combinedRealm.authSuccess",
-username, realm.getClass().getName()));
+gssName, realm.getClass().getName()));
 }
 break;
 }


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



[tomcat] branch 8.5.x updated: Clean-up. Indents and braces

2019-07-10 Thread markt
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 6e360bc  Clean-up. Indents and braces
6e360bc is described below

commit 6e360bc8c59bbdb3a917ce72239089218b252db1
Author: Mark Thomas 
AuthorDate: Wed Jul 10 09:03:26 2019 +0100

Clean-up. Indents and braces
---
 .../naming/factory/webservices/ServiceProxy.java   |  9 ++--
 .../factory/webservices/ServiceRefFactory.java | 54 +++---
 2 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/java/org/apache/naming/factory/webservices/ServiceProxy.java 
b/java/org/apache/naming/factory/webservices/ServiceProxy.java
index 4539c83..d6c03b1 100644
--- a/java/org/apache/naming/factory/webservices/ServiceProxy.java
+++ b/java/org/apache/naming/factory/webservices/ServiceProxy.java
@@ -101,8 +101,7 @@ public class ServiceProxy implements InvocationHandler {
  * @return Returns the correct Port
  * @throws ServiceException if port's QName is an unknown Port (not 
defined in WSDL).
  */
-private Object getProxyPortQNameClass(Object[] args)
-throws ServiceException {
+private Object getProxyPortQNameClass(Object[] args) throws 
ServiceException {
 QName name = (QName) args[0];
 String nameString = name.getLocalPart();
 Class serviceendpointClass = (Class) args[1];
@@ -131,12 +130,12 @@ public class ServiceProxy implements InvocationHandler {
  * @return Returns the correct Port
  * @throws ServiceException if port's QName is an unknown Port
  */
-private Remote getProxyPortClass(Object[] args)
-throws ServiceException {
+private Remote getProxyPortClass(Object[] args) throws ServiceException {
 Class serviceendpointClass = (Class) args[0];
 
-if (this.portComponentRef == null)
+if (this.portComponentRef == null) {
 return service.getPort(serviceendpointClass);
+}
 
 QName portname = 
this.portComponentRef.get(serviceendpointClass.getName());
 if (portname != null) {
diff --git a/java/org/apache/naming/factory/webservices/ServiceRefFactory.java 
b/java/org/apache/naming/factory/webservices/ServiceRefFactory.java
index 9f92d43..1f37d30 100644
--- a/java/org/apache/naming/factory/webservices/ServiceRefFactory.java
+++ b/java/org/apache/naming/factory/webservices/ServiceRefFactory.java
@@ -65,31 +65,32 @@ public class ServiceRefFactory implements ObjectFactory {
  */
 @Override
 public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-Hashtable environment)
-throws Exception {
+Hashtable environment) throws Exception {
 
 if (obj instanceof ServiceRef) {
 ServiceRef ref = (ServiceRef) obj;
 
 // ClassLoader
-ClassLoader tcl =
-Thread.currentThread().getContextClassLoader();
-if (tcl == null)
+ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+if (tcl == null) {
 tcl = this.getClass().getClassLoader();
+}
 ServiceFactory factory = ServiceFactory.newInstance();
 javax.xml.rpc.Service service = null;
 
 // Service Interface
 RefAddr tmp = ref.get(ServiceRef.SERVICE_INTERFACE);
 String serviceInterface = null;
-if (tmp != null)
+if (tmp != null) {
 serviceInterface = (String) tmp.getContent();
+}
 
 // WSDL
 tmp = ref.get(ServiceRef.WSDL);
 String wsdlRefAddr = null;
-if (tmp != null)
+if (tmp != null) {
 wsdlRefAddr = (String) tmp.getContent();
+}
 
 // PortComponent
 Hashtable portComponentRef = new Hashtable<>();
@@ -124,8 +125,7 @@ public class ServiceRefFactory implements ObjectFactory {
 serviceQname );
 }
 } catch (Exception e) {
-NamingException ex = new NamingException
-("Could not create service");
+NamingException ex = new NamingException("Could not create 
service");
 ex.initCause(e);
 throw ex;
 }
@@ -134,8 +134,7 @@ public class ServiceRefFactory implements ObjectFactory {
 try {
 serviceInterfaceClass = tcl.loadClass(serviceInterface);
 } catch(ClassNotFoundException e) {
-NamingException ex = new NamingException
-("Could not load service Interface");
+NamingException ex = new NamingException("Could not load 
service Interface");
 ex.initCause(e);
 throw ex;

[tomcat] branch 8.5.x updated: Clean-up. Spacing, unnecessary code, etc. No functional change

2019-07-09 Thread markt
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 83911c2  Clean-up. Spacing,unnecessary code, etc. No functional change
83911c2 is described below

commit 83911c2698d8e140ea35d0d979eb1a38de0c0dbe
Author: Mark Thomas 
AuthorDate: Tue Jul 9 12:18:23 2019 +0100

Clean-up. Spacing,unnecessary code, etc. No functional change
---
 java/org/apache/catalina/connector/Request.java | 134 
 1 file changed, 44 insertions(+), 90 deletions(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index 48786cd..0fdfc63 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -740,6 +740,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 return mappingData.wrapper;
 }
 
+
 /**
  * @param wrapper The newly associated Wrapper
  * @deprecated Use setters on {@link #getMappingData() MappingData} object.
@@ -755,7 +756,6 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 
 // - Request Public Methods
 
-
 /**
  * Create and return a ServletInputStream to read the content
  * associated with this Request.
@@ -764,7 +764,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
  * @exception IOException if an input/output error occurs
  */
 public ServletInputStream createInputStream()
-throws IOException {
+throws IOException {
 if (inputStream == null) {
 inputStream = new CoyoteInputStream(inputBuffer);
 }
@@ -872,8 +872,6 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 
 // - ServletRequest Methods
 
-
-
 /**
  * @return the specified request attribute if it exists; otherwise, return
  * null.
@@ -891,7 +889,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 Object attr = attributes.get(name);
 
 if (attr != null) {
-return(attr);
+return attr;
 }
 
 attr = coyoteRequest.getAttribute(name);
@@ -1065,8 +1063,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 public ServletInputStream getInputStream() throws IOException {
 
 if (usingReader) {
-throw new IllegalStateException
-(sm.getString("coyoteRequest.getInputStream.ise"));
+throw new 
IllegalStateException(sm.getString("coyoteRequest.getInputStream.ise"));
 }
 
 usingInputStream = true;
@@ -1228,8 +1225,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 public BufferedReader getReader() throws IOException {
 
 if (usingInputStream) {
-throw new IllegalStateException
-(sm.getString("coyoteRequest.getReader.ise"));
+throw new 
IllegalStateException(sm.getString("coyoteRequest.getReader.ise"));
 }
 
 usingReader = true;
@@ -1238,7 +1234,6 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 reader = new CoyoteReader(inputBuffer);
 }
 return reader;
-
 }
 
 
@@ -1277,8 +1272,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 @Override
 public String getRemoteAddr() {
 if (remoteAddr == null) {
-coyoteRequest.action
-(ActionCode.REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
+coyoteRequest.action(ActionCode.REQ_HOST_ADDR_ATTRIBUTE, 
coyoteRequest);
 remoteAddr = coyoteRequest.remoteAddr().toString();
 }
 return remoteAddr;
@@ -1294,8 +1288,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 if (!connector.getEnableLookups()) {
 remoteHost = getRemoteAddr();
 } else {
-coyoteRequest.action
-(ActionCode.REQ_HOST_ATTRIBUTE, coyoteRequest);
+coyoteRequest.action(ActionCode.REQ_HOST_ATTRIBUTE, 
coyoteRequest);
 remoteHost = coyoteRequest.remoteHost().toString();
 }
 }
@@ -1309,8 +1302,7 @@ public class Request implements 
org.apache.catalina.servlet4preview.http.HttpSer
 @Override
 public int getRemotePort(){
 if (remotePort == -1) {
-coyoteRequest.action
-(ActionCode.REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
+coyoteRequest.action(ActionCode.REQ_REMOTEPORT_ATTRIBUTE, 
coyoteRequest);
 remotePort

[tomcat] branch 8.5.x updated: Clean-up. No functional change.

2019-06-24 Thread markt
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 912d12f  Clean-up. No functional change.
912d12f is described below

commit 912d12fe1c49e8ba9027f5480cfbeadb523f6162
Author: Mark Thomas 
AuthorDate: Mon Jun 24 14:27:42 2019 +0100

Clean-up. No functional change.
---
 .../apache/catalina/users/MemoryUserDatabase.java  | 90 +++---
 1 file changed, 26 insertions(+), 64 deletions(-)

diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java 
b/java/org/apache/catalina/users/MemoryUserDatabase.java
index 4730173..ea99d6d 100644
--- a/java/org/apache/catalina/users/MemoryUserDatabase.java
+++ b/java/org/apache/catalina/users/MemoryUserDatabase.java
@@ -39,20 +39,20 @@ import org.apache.tomcat.util.res.StringManager;
 import org.xml.sax.Attributes;
 
 /**
- * Concrete implementation of {@link UserDatabase} that loads all
- * defined users, groups, and roles into an in-memory data structure,
- * and uses a specified XML file for its persistent storage.
+ * Concrete implementation of {@link UserDatabase} that loads all defined 
users,
+ * groups, and roles into an in-memory data structure, and uses a specified XML
+ * file for its persistent storage.
  *
  * @author Craig R. McClanahan
  * @since 4.1
  */
 public class MemoryUserDatabase implements UserDatabase {
 
-
 private static final Log log = LogFactory.getLog(MemoryUserDatabase.class);
+private static final StringManager sm = 
StringManager.getManager(MemoryUserDatabase.class);
 
-// --- Constructors
 
+// --- Constructors
 
 /**
  * Create a new instance with default values.
@@ -71,73 +71,55 @@ public class MemoryUserDatabase implements UserDatabase {
 this.id = id;
 }
 
-
 // - Instance Variables
 
-
 /**
- * The set of {@link Group}s defined in this database, keyed by
- * group name.
+ * The set of {@link Group}s defined in this database, keyed by group name.
  */
-protected final HashMap groups = new HashMap<>();
-
+protected final HashMap groups = new HashMap<>();
 
 /**
  * The unique global identifier of this user database.
  */
 protected final String id;
 
-
 /**
- * The relative (to catalina.base) or absolute pathname to
- * the XML file in which we will save our persistent information.
+ * The relative (to catalina.base) or absolute pathname to the
+ * XML file in which we will save our persistent information.
  */
 protected String pathname = "conf/tomcat-users.xml";
 
-
 /**
  * The relative or absolute pathname to the file in which our old
  * information is stored while renaming is in progress.
  */
 protected String pathnameOld = pathname + ".old";
 
-
 /**
- * The relative or absolute pathname of the file in which we write
- * our new information prior to renaming.
+ * The relative or absolute pathname of the file in which we write our new
+ * information prior to renaming.
  */
 protected String pathnameNew = pathname + ".new";
 
-
 /**
  * A flag, indicating if the user database is read only.
  */
 protected boolean readonly = true;
 
 /**
- * The set of {@link Role}s defined in this database, keyed by
- * role name.
+ * The set of {@link Role}s defined in this database, keyed by role name.
  */
-protected final HashMap roles = new HashMap<>();
+protected final HashMap roles = new HashMap<>();
 
 
 /**
- * The string manager for this package.
- */
-private static final StringManager sm =
-StringManager.getManager(Constants.Package);
-
-
-/**
- * The set of {@link User}s defined in this database, keyed by
- * user name.
+ * The set of {@link User}s defined in this database, keyed by user name.
  */
 protected final HashMap users = new HashMap<>();
 
 
 // - Properties
 
-
 /**
  * @return the set of {@link Group}s defined in this user database.
  */
@@ -172,11 +154,9 @@ public class MemoryUserDatabase implements UserDatabase {
  * @param pathname The new pathname
  */
 public void setPathname(String pathname) {
-
 this.pathname = pathname;
 this.pathnameOld = pathname + ".old";
 this.pathnameNew = pathname + ".new";
-
 }
 
 
@@ -194,9 +174,7 @@ public class MemoryUserDatabase implements UserDatabase {
  * @param readonly the new status
  */
 public void setReadonly(boolean readonly) {
-
 this.readonly = readonly;
-
 }
 
 
@@ -222,10 +200,8 @@ public class MemoryUserDatab

[tomcat] branch 8.5.x updated: Clean-up to align 8.5.x with 9.0.x

2019-06-24 Thread markt
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 4b45d66  Clean-up to align 8.5.x with 9.0.x
4b45d66 is described below

commit 4b45d66f423e9a7adc9aaa967e6d780813ce5fde
Author: Mark Thomas 
AuthorDate: Mon Jun 24 14:17:35 2019 +0100

Clean-up to align 8.5.x with 9.0.x
---
 java/org/apache/catalina/users/MemoryGroup.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/users/MemoryGroup.java 
b/java/org/apache/catalina/users/MemoryGroup.java
index 859214b..59262c2 100644
--- a/java/org/apache/catalina/users/MemoryGroup.java
+++ b/java/org/apache/catalina/users/MemoryGroup.java
@@ -21,6 +21,7 @@ package org.apache.catalina.users;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.catalina.Role;
 import org.apache.catalina.User;
@@ -104,7 +105,7 @@ public class MemoryGroup extends AbstractGroup {
  */
 @Override
 public Iterator getUsers() {
-ArrayList results = new ArrayList<>();
+List results = new ArrayList<>();
 Iterator users = database.getUsers();
 while (users.hasNext()) {
 User user = users.next();


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



[tomcat] branch 8.5.x updated: Clean-up

2019-06-04 Thread markt
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 dacb1bc  Clean-up
dacb1bc is described below

commit dacb1bc0d156c25a865c026bcbca3c71d3afe9e9
Author: Mark Thomas 
AuthorDate: Tue Jun 4 16:38:15 2019 +0100

Clean-up
---
 java/javax/servlet/http/HttpServlet.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/javax/servlet/http/HttpServlet.java 
b/java/javax/servlet/http/HttpServlet.java
index 9f3fe92..f7ea58a 100644
--- a/java/javax/servlet/http/HttpServlet.java
+++ b/java/javax/servlet/http/HttpServlet.java
@@ -593,7 +593,6 @@ public abstract class HttpServlet extends GenericServlet {
 ServletOutputStream out = resp.getOutputStream();
 out.print(buffer.toString());
 out.close();
-return;
 }
 
 


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