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 a6d1837 Align master, 9.0.x and 8.5.x
a6d1837 is described below
commit a6d18378bf72e05339430b8c382b224a94366de0
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jan 15 16:38:48 2020 +0000
Align master, 9.0.x and 8.5.x
---
java/org/apache/catalina/ant/AbstractCatalinaTask.java | 15 +++------------
java/org/apache/catalina/ant/ValidatorTask.java | 2 +-
java/org/apache/catalina/ant/jmx/JMXAccessorTask.java | 10 +++-------
.../authenticator/jaspic/AuthConfigFactoryImpl.java | 4 +---
.../authenticator/jaspic/SimpleServerAuthConfig.java | 5 +----
java/org/apache/catalina/connector/Connector.java | 8 ++++++--
6 files changed, 15 insertions(+), 29 deletions(-)
diff --git a/java/org/apache/catalina/ant/AbstractCatalinaTask.java
b/java/org/apache/catalina/ant/AbstractCatalinaTask.java
index 32e09f7..0d30fe2 100644
--- a/java/org/apache/catalina/ant/AbstractCatalinaTask.java
+++ b/java/org/apache/catalina/ant/AbstractCatalinaTask.java
@@ -16,10 +16,10 @@
*/
package org.apache.catalina.ant;
-import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.PasswordAuthentication;
@@ -210,17 +210,8 @@ public abstract class AbstractCatalinaTask extends
BaseRedirectorHelperTask {
// Send the request data (if any)
if (istream != null) {
- try (BufferedOutputStream ostream = new BufferedOutputStream(
- hconn.getOutputStream(), 1024);) {
- byte buffer[] = new byte[1024];
- while (true) {
- int n = istream.read(buffer);
- if (n < 0) {
- break;
- }
- ostream.write(buffer, 0, n);
- }
- ostream.flush();
+ try (OutputStream ostream = hconn.getOutputStream()) {
+ IOTools.flow(istream, ostream);
} finally {
try {
istream.close();
diff --git a/java/org/apache/catalina/ant/ValidatorTask.java
b/java/org/apache/catalina/ant/ValidatorTask.java
index 896b7c7..1ac95ac 100644
--- a/java/org/apache/catalina/ant/ValidatorTask.java
+++ b/java/org/apache/catalina/ant/ValidatorTask.java
@@ -91,7 +91,7 @@ public class ValidatorTask extends BaseRedirectorHelperTask {
// SecurityManager assume that untrusted applications may be deployed.
Digester digester = DigesterFactory.newDigester(
true, true, null, Globals.IS_SECURITY_ENABLED);
- try (InputStream stream = new BufferedInputStream(new
FileInputStream(file.getCanonicalFile()));) {
+ try (InputStream stream = new BufferedInputStream(new
FileInputStream(file.getCanonicalFile()))) {
InputSource is = new
InputSource(file.toURI().toURL().toExternalForm());
is.setByteStream(stream);
digester.parse(is);
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
b/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
index 0b6381b..8d5d268 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
@@ -23,7 +23,6 @@ import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -617,8 +616,7 @@ public class JMXAccessorTask extends
BaseRedirectorHelperTask {
CompositeDataSupport data = (CompositeDataSupport) result;
CompositeType compositeType = data.getCompositeType();
Set<String> keys = compositeType.keySet();
- for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
- String key = iter.next();
+ for (String key : keys) {
Object value = data.get(key);
OpenType<?> type = compositeType.getType(key);
if (type instanceof SimpleType<?>) {
@@ -629,10 +627,8 @@ public class JMXAccessorTask extends
BaseRedirectorHelperTask {
}
} else if (result instanceof TabularDataSupport) {
TabularDataSupport data = (TabularDataSupport) result;
- for (Iterator<Object> iter = data.keySet().iterator();
iter.hasNext();) {
- Object key = iter.next();
- for (Iterator<?> iter1 = ((List<?>) key).iterator();
iter1.hasNext();) {
- Object key1 = iter1.next();
+ for (Object key : data.keySet()) {
+ for (Object key1 : ((List<?>) key)) {
CompositeData valuedata = data.get(new Object[] { key1 });
Object value = valuedata.get("value");
OpenType<?> type = valuedata.getCompositeType().getType(
diff --git
a/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
b/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
index b5ce610..ee1dd5f 100644
--- a/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
+++ b/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
@@ -18,7 +18,6 @@ package org.apache.catalina.authenticator.jaspic;
import java.io.File;
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -135,8 +134,7 @@ public class AuthConfigFactoryImpl extends
AuthConfigFactory {
}
Constructor<?> constructor = clazz.getConstructor(Map.class,
AuthConfigFactory.class);
provider = (AuthConfigProvider)
constructor.newInstance(properties, null);
- } catch (ClassNotFoundException | NoSuchMethodException |
InstantiationException |
- IllegalAccessException | IllegalArgumentException |
InvocationTargetException e) {
+ } catch (ReflectiveOperationException | IllegalArgumentException e) {
throw new SecurityException(e);
}
return provider;
diff --git
a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
index 99b9b45..15d29e1 100644
--- a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
+++ b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
@@ -16,7 +16,6 @@
*/
package org.apache.catalina.authenticator.jaspic;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -118,9 +117,7 @@ public class SimpleServerAuthConfig implements
ServerAuthConfig {
(ServerAuthModule)
clazz.getConstructor().newInstance();
module.initialize(null, null, handler,
mergedProperties);
modules.add(module);
- } catch (ClassNotFoundException |
InstantiationException |
- IllegalAccessException |
IllegalArgumentException |
- InvocationTargetException |
NoSuchMethodException |
+ } catch (ReflectiveOperationException |
IllegalArgumentException |
SecurityException e) {
AuthException ae = new AuthException();
ae.initCause(e);
diff --git a/java/org/apache/catalina/connector/Connector.java
b/java/org/apache/catalina/connector/Connector.java
index d85a193..ee4c9e3 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -64,12 +64,16 @@ public class Connector extends LifecycleMBeanBase {
Boolean.parseBoolean(System.getProperty("org.apache.catalina.connector.RECYCLE_FACADES",
"false"));
+ public static final String INTERNAL_EXECUTOR_NAME = "Internal";
+
+
// ------------------------------------------------------------ Constructor
public Connector() {
this(null);
}
+
public Connector(String protocol) {
setProtocol(protocol);
// Instantiate protocol handler
@@ -774,7 +778,7 @@ public class Connector extends LifecycleMBeanBase {
try {
uriCharset = B2CConverter.getCharset(URIEncoding);
} catch (UnsupportedEncodingException e) {
- log.warn(sm.getString("coyoteConnector.invalidEncoding",
+ log.error(sm.getString("coyoteConnector.invalidEncoding",
URIEncoding, uriCharset.name()), e);
}
setProperty("uRIEncoding", URIEncoding);
@@ -852,7 +856,7 @@ public class Connector extends LifecycleMBeanBase {
if (obj instanceof org.apache.catalina.Executor) {
return ((org.apache.catalina.Executor) obj).getName();
}
- return "Internal";
+ return INTERNAL_EXECUTOR_NAME;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]