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 b1c56a9 Code clean-up. Add braces to improve clarity b1c56a9 is described below commit b1c56a97bda6212f8f7a00cac06e562f79fd9666 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed May 26 19:27:37 2021 +0100 Code clean-up. Add braces to improve clarity Again, mainly to trigger CI to test configuration changes. --- java/org/apache/juli/ClassLoaderLogManager.java | 6 +- java/org/apache/juli/JdkLoggerFormatter.java | 3 +- .../org/apache/naming/ContextAccessController.java | 3 +- java/org/apache/naming/NamingContext.java | 33 +++-- .../naming/factory/DataSourceLinkFactory.java | 5 +- java/org/apache/naming/factory/LookupFactory.java | 3 +- .../apache/naming/factory/MailSessionFactory.java | 3 +- java/org/apache/tomcat/jni/Library.java | 5 +- .../util/bcel/classfile/EnumElementValue.java | 3 +- .../tomcat/util/descriptor/tld/TldRuleSet.java | 3 +- .../tomcat/util/descriptor/web/ContextService.java | 3 +- .../tomcat/util/descriptor/web/FilterMap.java | 4 +- .../tomcat/util/descriptor/web/LoginConfig.java | 30 +++-- .../util/descriptor/web/SecurityCollection.java | 45 ++++--- .../util/descriptor/web/SecurityConstraint.java | 68 ++++++---- .../tomcat/util/descriptor/web/WebRuleSet.java | 9 +- .../apache/tomcat/util/descriptor/web/WebXml.java | 4 +- java/org/apache/tomcat/util/digester/Digester.java | 3 +- java/org/apache/tomcat/util/http/RequestUtil.java | 6 +- .../apache/tomcat/util/modeler/AttributeInfo.java | 14 +- .../tomcat/util/modeler/BaseAttributeFilter.java | 17 ++- .../apache/tomcat/util/modeler/BaseModelMBean.java | 143 +++++++++++++-------- .../util/modeler/BaseNotificationBroadcaster.java | 7 +- .../apache/tomcat/util/modeler/ManagedBean.java | 45 ++++--- .../tomcat/util/modeler/NotificationInfo.java | 3 +- .../apache/tomcat/util/modeler/OperationInfo.java | 15 ++- java/org/apache/tomcat/util/modeler/Registry.java | 12 +- .../MbeansDescriptorsIntrospectionSource.java | 32 +++-- .../apache/tomcat/util/net/AbstractEndpoint.java | 34 +++-- java/org/apache/tomcat/util/net/AprEndpoint.java | 6 +- java/org/apache/tomcat/util/net/NioEndpoint.java | 4 +- .../apache/tomcat/util/net/SSLImplementation.java | 3 +- .../apache/tomcat/util/net/SecureNio2Channel.java | 37 ++++-- .../apache/tomcat/util/net/SecureNioChannel.java | 4 +- .../apache/tomcat/util/net/SocketProperties.java | 60 ++++++--- .../apache/tomcat/util/net/jsse/JSSESupport.java | 30 +++-- .../tomcat/util/net/openssl/OpenSSLContext.java | 12 +- .../ciphers/OpenSSLCipherConfigurationParser.java | 14 +- res/checkstyle/checkstyle.xml | 2 +- 39 files changed, 489 insertions(+), 244 deletions(-) diff --git a/java/org/apache/juli/ClassLoaderLogManager.java b/java/org/apache/juli/ClassLoaderLogManager.java index a04285c..a9dc664 100644 --- a/java/org/apache/juli/ClassLoaderLogManager.java +++ b/java/org/apache/juli/ClassLoaderLogManager.java @@ -460,18 +460,20 @@ public class ClassLoaderLogManager extends LogManager { URL logConfig = ((URLClassLoader)classLoader).findResource("logging.properties"); if(null != logConfig) { - if(Boolean.getBoolean(DEBUG_PROPERTY)) + if(Boolean.getBoolean(DEBUG_PROPERTY)) { System.err.println(getClass().getName() + ".readConfiguration(): " + "Found logging.properties at " + logConfig); + } is = classLoader.getResourceAsStream("logging.properties"); } else { - if(Boolean.getBoolean(DEBUG_PROPERTY)) + if(Boolean.getBoolean(DEBUG_PROPERTY)) { System.err.println(getClass().getName() + ".readConfiguration(): " + "Found no logging.properties"); + } } } } catch (AccessControlException ace) { diff --git a/java/org/apache/juli/JdkLoggerFormatter.java b/java/org/apache/juli/JdkLoggerFormatter.java index 99b9096..d38b7d5 100644 --- a/java/org/apache/juli/JdkLoggerFormatter.java +++ b/java/org/apache/juli/JdkLoggerFormatter.java @@ -56,8 +56,9 @@ public class JdkLoggerFormatter extends Formatter { String message=formatMessage(record); - if( name.indexOf('.') >= 0 ) + if( name.indexOf('.') >= 0 ) { name = name.substring(name.lastIndexOf('.') + 1); + } // Use a string buffer for better performance StringBuilder buf = new StringBuilder(); diff --git a/java/org/apache/naming/ContextAccessController.java b/java/org/apache/naming/ContextAccessController.java index 20f751b..301d648 100644 --- a/java/org/apache/naming/ContextAccessController.java +++ b/java/org/apache/naming/ContextAccessController.java @@ -97,8 +97,9 @@ public class ContextAccessController { * @param token Security token */ public static void setWritable(Object name, Object token) { - if (checkSecurityToken(name, token)) + if (checkSecurityToken(name, token)) { readOnlyContexts.remove(name); + } } diff --git a/java/org/apache/naming/NamingContext.java b/java/org/apache/naming/NamingContext.java index 37b42e3..87b2c13 100644 --- a/java/org/apache/naming/NamingContext.java +++ b/java/org/apache/naming/NamingContext.java @@ -269,11 +269,13 @@ public class NamingContext implements Context { return; } - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); - if (name.isEmpty()) + } + if (name.isEmpty()) { throw new NamingException (sm.getString("namingContext.invalidName")); + } NamingEntry entry = bindings.get(name.get(0)); @@ -364,8 +366,9 @@ public class NamingContext implements Context { public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { // Removing empty parts - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); + } if (name.isEmpty()) { return new NamingContextEnumeration(bindings.values().iterator()); } @@ -418,8 +421,9 @@ public class NamingContext implements Context { public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { // Removing empty parts - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); + } if (name.isEmpty()) { return new NamingContextBindingsEnumeration(bindings.values().iterator(), this); } @@ -487,11 +491,13 @@ public class NamingContext implements Context { return; } - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); - if (name.isEmpty()) + } + if (name.isEmpty()) { throw new NamingException (sm.getString("namingContext.invalidName")); + } NamingEntry entry = bindings.get(name.get(0)); @@ -632,10 +638,12 @@ public class NamingContext implements Context { public NameParser getNameParser(Name name) throws NamingException { - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); - if (name.isEmpty()) + } + if (name.isEmpty()) { return nameParser; + } if (name.size() > 1) { Object obj = bindings.get(name.get(0)); @@ -803,8 +811,9 @@ public class NamingContext implements Context { throws NamingException { // Removing empty parts - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); + } if (name.isEmpty()) { // If name is empty, a newly allocated naming context is returned return new NamingContext(env, this.name, bindings); @@ -888,11 +897,13 @@ public class NamingContext implements Context { return; } - while ((!name.isEmpty()) && (name.get(0).length() == 0)) + while ((!name.isEmpty()) && (name.get(0).length() == 0)) { name = name.getSuffix(1); - if (name.isEmpty()) + } + if (name.isEmpty()) { throw new NamingException (sm.getString("namingContext.invalidName")); + } NamingEntry entry = bindings.get(name.get(0)); diff --git a/java/org/apache/naming/factory/DataSourceLinkFactory.java b/java/org/apache/naming/factory/DataSourceLinkFactory.java index bd029fe..1834670 100644 --- a/java/org/apache/naming/factory/DataSourceLinkFactory.java +++ b/java/org/apache/naming/factory/DataSourceLinkFactory.java @@ -86,8 +86,9 @@ public class DataSourceLinkFactory extends ResourceLinkFactory { x = (Exception) cause; } } - if (x instanceof NamingException) throw (NamingException)x; - else { + if (x instanceof NamingException) { + throw (NamingException)x; + } else { NamingException nx = new NamingException(x.getMessage()); nx.initCause(x); throw nx; diff --git a/java/org/apache/naming/factory/LookupFactory.java b/java/org/apache/naming/factory/LookupFactory.java index 6e7455c..627f4ad 100644 --- a/java/org/apache/naming/factory/LookupFactory.java +++ b/java/org/apache/naming/factory/LookupFactory.java @@ -108,8 +108,9 @@ public class LookupFactory implements ObjectFactory { try { factory = (ObjectFactory) factoryClass.getConstructor().newInstance(); } catch (Throwable t) { - if (t instanceof NamingException) + if (t instanceof NamingException) { throw (NamingException) t; + } NamingException ex = new NamingException( sm.getString("lookupFactory.createFailed")); ex.initCause(t); diff --git a/java/org/apache/naming/factory/MailSessionFactory.java b/java/org/apache/naming/factory/MailSessionFactory.java index fc87930..389f7d9 100644 --- a/java/org/apache/naming/factory/MailSessionFactory.java +++ b/java/org/apache/naming/factory/MailSessionFactory.java @@ -93,8 +93,9 @@ public class MailSessionFactory implements ObjectFactory { // Return null if we cannot create an object of the requested type final Reference ref = (Reference) refObj; - if (!ref.getClassName().equals(factoryType)) + if (!ref.getClassName().equals(factoryType)) { return null; + } // Create a new Session inside a doPrivileged block, so that JavaMail // can read its default properties without throwing Security diff --git a/java/org/apache/tomcat/jni/Library.java b/java/org/apache/tomcat/jni/Library.java index 9c2ca34..fb8cf92 100644 --- a/java/org/apache/tomcat/jni/Library.java +++ b/java/org/apache/tomcat/jni/Library.java @@ -174,10 +174,11 @@ public final class Library { */ public static synchronized boolean initialize(String libraryName) throws Exception { if (_instance == null) { - if (libraryName == null) + if (libraryName == null) { _instance = new Library(); - else + } else { _instance = new Library(libraryName); + } TCN_MAJOR_VERSION = version(0x01); TCN_MINOR_VERSION = version(0x02); TCN_PATCH_VERSION = version(0x03); diff --git a/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java b/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java index d4c3171..7e95a1e 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java +++ b/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java @@ -25,9 +25,10 @@ public class EnumElementValue extends ElementValue EnumElementValue(final int type, final int valueIdx, final ConstantPool cpool) { super(type, cpool); - if (type != ENUM_CONSTANT) + if (type != ENUM_CONSTANT) { throw new IllegalArgumentException( "Only element values of type enum can be built with this ctor - type specified: " + type); + } this.valueIdx = valueIdx; } diff --git a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java index 9f250f5..44d61e9 100644 --- a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java +++ b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java @@ -353,8 +353,9 @@ public class TldRuleSet extends RuleSetBase { @Override public void body(String namespace, String name, String text) throws Exception { - if(null != text) + if(null != text) { text = text.trim(); + } boolean value = "true".equalsIgnoreCase(text) || "yes".equalsIgnoreCase(text); setter.invoke(digester.peek(), Boolean.valueOf(value)); } diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextService.java b/java/org/apache/tomcat/util/descriptor/web/ContextService.java index 87bbd56..af65361 100644 --- a/java/org/apache/tomcat/util/descriptor/web/ContextService.java +++ b/java/org/apache/tomcat/util/descriptor/web/ContextService.java @@ -176,8 +176,9 @@ public class ContextService extends ResourceBase { } public void addPortcomponent(String serviceendpoint, String portlink) { - if (portlink == null) + if (portlink == null) { portlink = ""; + } this.setProperty(serviceendpoint, portlink); } diff --git a/java/org/apache/tomcat/util/descriptor/web/FilterMap.java b/java/org/apache/tomcat/util/descriptor/web/FilterMap.java index aeb9199..5965104 100644 --- a/java/org/apache/tomcat/util/descriptor/web/FilterMap.java +++ b/java/org/apache/tomcat/util/descriptor/web/FilterMap.java @@ -170,7 +170,9 @@ public class FilterMap extends XmlEncodingBase implements Serializable { public int getDispatcherMapping() { // per the SRV.6.2.5 absence of any dispatcher elements is // equivalent to a REQUEST value - if (dispatcherMapping == NOT_SET) return REQUEST; + if (dispatcherMapping == NOT_SET) { + return REQUEST; + } return dispatcherMapping; } diff --git a/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java b/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java index afe9aa9..61332aa 100644 --- a/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java +++ b/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java @@ -184,31 +184,41 @@ public class LoginConfig extends XmlEncodingBase implements Serializable { */ @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (!(obj instanceof LoginConfig)) + } + if (!(obj instanceof LoginConfig)) { return false; + } LoginConfig other = (LoginConfig) obj; if (authMethod == null) { - if (other.authMethod != null) + if (other.authMethod != null) { return false; - } else if (!authMethod.equals(other.authMethod)) + } + } else if (!authMethod.equals(other.authMethod)) { return false; + } if (errorPage == null) { - if (other.errorPage != null) + if (other.errorPage != null) { return false; - } else if (!errorPage.equals(other.errorPage)) + } + } else if (!errorPage.equals(other.errorPage)) { return false; + } if (loginPage == null) { - if (other.loginPage != null) + if (other.loginPage != null) { return false; - } else if (!loginPage.equals(other.loginPage)) + } + } else if (!loginPage.equals(other.loginPage)) { return false; + } if (realmName == null) { - if (other.realmName != null) + if (other.realmName != null) { return false; - } else if (!realmName.equals(other.realmName)) + } + } else if (!realmName.equals(other.realmName)) { return false; + } return true; } diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java b/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java index 44a79ca..583a44c 100644 --- a/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java +++ b/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java @@ -172,11 +172,13 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable */ public void addMethod(String method) { - if (method == null) + if (method == null) { return; + } String results[] = new String[methods.length + 1]; - for (int i = 0; i < methods.length; i++) + for (int i = 0; i < methods.length; i++) { results[i] = methods[i]; + } results[methods.length] = method; methods = results; @@ -189,11 +191,13 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable * @param method The method */ public void addOmittedMethod(String method) { - if (method == null) + if (method == null) { return; + } String results[] = new String[omittedMethods.length + 1]; - for (int i = 0; i < omittedMethods.length; i++) + for (int i = 0; i < omittedMethods.length; i++) { results[i] = omittedMethods[i]; + } results[omittedMethods.length] = method; omittedMethods = results; } @@ -207,8 +211,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable } public void addPatternDecoded(String pattern) { - if (pattern == null) + if (pattern == null) { return; + } String decodedPattern = UDecoder.URLDecode(pattern, getCharset()); String[] results = Arrays.copyOf(patterns, patterns.length + 1); @@ -225,19 +230,22 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable */ public boolean findMethod(String method) { - if (methods.length == 0 && omittedMethods.length == 0) + if (methods.length == 0 && omittedMethods.length == 0) { return true; + } if (methods.length > 0) { for (String s : methods) { - if (s.equals(method)) + if (s.equals(method)) { return true; + } } return false; } if (omittedMethods.length > 0) { for (String omittedMethod : omittedMethods) { - if (omittedMethod.equals(method)) + if (omittedMethod.equals(method)) { return false; + } } } return true; @@ -272,8 +280,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable */ public boolean findPattern(String pattern) { for (String s : patterns) { - if (s.equals(pattern)) + if (s.equals(pattern)) { return true; + } } return false; } @@ -297,8 +306,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable */ public void removeMethod(String method) { - if (method == null) + if (method == null) { return; + } int n = -1; for (int i = 0; i < methods.length; i++) { if (methods[i].equals(method)) { @@ -310,8 +320,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable int j = 0; String results[] = new String[methods.length - 1]; for (int i = 0; i < methods.length; i++) { - if (i != n) + if (i != n) { results[j++] = methods[i]; + } } methods = results; } @@ -327,8 +338,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable */ public void removeOmittedMethod(String method) { - if (method == null) + if (method == null) { return; + } int n = -1; for (int i = 0; i < omittedMethods.length; i++) { if (omittedMethods[i].equals(method)) { @@ -340,8 +352,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable int j = 0; String results[] = new String[omittedMethods.length - 1]; for (int i = 0; i < omittedMethods.length; i++) { - if (i != n) + if (i != n) { results[j++] = omittedMethods[i]; + } } omittedMethods = results; } @@ -357,8 +370,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable */ public void removePattern(String pattern) { - if (pattern == null) + if (pattern == null) { return; + } int n = -1; for (int i = 0; i < patterns.length; i++) { if (patterns[i].equals(pattern)) { @@ -370,8 +384,9 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable int j = 0; String results[] = new String[patterns.length - 1]; for (int i = 0; i < patterns.length; i++) { - if (i != n) + if (i != n) { results[j++] = patterns[i]; + } } patterns = results; } diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java b/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java index 7215874..271ea34 100644 --- a/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java +++ b/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java @@ -213,8 +213,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable */ public void setUserConstraint(String userConstraint) { - if (userConstraint != null) + if (userConstraint != null) { this.userConstraint = userConstraint; + } } @@ -248,8 +249,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable */ public void addAuthRole(String authRole) { - if (authRole == null) + if (authRole == null) { return; + } if (ROLE_ALL_ROLES.equals(authRole)) { allRoles = true; @@ -287,8 +289,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable */ public void addCollection(SecurityCollection collection) { - if (collection == null) + if (collection == null) { return; + } collection.setCharset(getCharset()); @@ -311,11 +314,13 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable */ public boolean findAuthRole(String role) { - if (role == null) + if (role == null) { return false; + } for (String authRole : authRoles) { - if (role.equals(authRole)) + if (role.equals(authRole)) { return true; + } } return false; @@ -342,11 +347,13 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable * @return the collection */ public SecurityCollection findCollection(String name) { - if (name == null) + if (name == null) { return null; + } for (SecurityCollection collection : collections) { - if (name.equals(collection.getName())) + if (name.equals(collection.getName())) { return collection; + } } return null; } @@ -373,17 +380,20 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable public boolean included(String uri, String method) { // We cannot match without a valid request method - if (method == null) + if (method == null) { return false; + } // Check all of the collections included in this constraint for (SecurityCollection collection : collections) { - if (!collection.findMethod(method)) + if (!collection.findMethod(method)) { continue; + } String patterns[] = collection.findPatterns(); for (String pattern : patterns) { - if (matchPattern(uri, pattern)) + if (matchPattern(uri, pattern)) { return true; + } } } @@ -401,8 +411,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable */ public void removeAuthRole(String authRole) { - if (authRole == null) + if (authRole == null) { return; + } if (ROLE_ALL_ROLES.equals(authRole)) { allRoles = false; @@ -425,8 +436,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable int j = 0; String results[] = new String[authRoles.length - 1]; for (int i = 0; i < authRoles.length; i++) { - if (i != n) + if (i != n) { results[j++] = authRoles[i]; + } } authRoles = results; } @@ -441,8 +453,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable */ public void removeCollection(SecurityCollection collection) { - if (collection == null) + if (collection == null) { return; + } int n = -1; for (int i = 0; i < collections.length; i++) { if (collections[i].equals(collection)) { @@ -455,8 +468,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable SecurityCollection results[] = new SecurityCollection[collections.length - 1]; for (int i = 0; i < collections.length; i++) { - if (i != n) + if (i != n) { results[j++] = collections[i]; + } } collections = results; } @@ -471,8 +485,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable public String toString() { StringBuilder sb = new StringBuilder("SecurityConstraint["); for (int i = 0; i < collections.length; i++) { - if (i > 0) + if (i > 0) { sb.append(", "); + } sb.append(collections[i].getName()); } sb.append(']'); @@ -495,28 +510,36 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable private boolean matchPattern(String path, String pattern) { // Normalize the argument strings - if ((path == null) || (path.length() == 0)) + if ((path == null) || (path.length() == 0)) { path = "/"; - if ((pattern == null) || (pattern.length() == 0)) + } + if ((pattern == null) || (pattern.length() == 0)) { pattern = "/"; + } // Check for exact match - if (path.equals(pattern)) + if (path.equals(pattern)) { return true; + } // Check for path prefix matching if (pattern.startsWith("/") && pattern.endsWith("/*")) { pattern = pattern.substring(0, pattern.length() - 2); if (pattern.length() == 0) + { return true; // "/*" is the same as "/" - if (path.endsWith("/")) + } + if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); + } while (true) { - if (pattern.equals(path)) + if (pattern.equals(path)) { return true; + } int slash = path.lastIndexOf('/'); - if (slash <= 0) + if (slash <= 0) { break; + } path = path.substring(0, slash); } return false; @@ -534,8 +557,9 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable } // Check for universal mapping - if (pattern.equals("/")) + if (pattern.equals("/")) { return true; + } return false; diff --git a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java index af729d7..0aadec2 100644 --- a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java +++ b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java @@ -882,9 +882,10 @@ final class SetPublicIdRule extends Rule { } m.invoke(top, (Object [])paramValues); - if (digester.getLogger().isDebugEnabled()) + if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug("" + top.getClass().getName() + "." + method + "(" + paramValues[0] + ")"); + } } @@ -907,16 +908,18 @@ final class ServletDefCreateRule extends Rule { throws Exception { ServletDef servletDef = new ServletDef(); digester.push(servletDef); - if (digester.getLogger().isDebugEnabled()) + if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug("new " + servletDef.getClass().getName()); + } } @Override public void end(String namespace, String name) throws Exception { ServletDef servletDef = (ServletDef) digester.pop(); - if (digester.getLogger().isDebugEnabled()) + if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug("pop " + servletDef.getClass().getName()); + } } } diff --git a/java/org/apache/tomcat/util/descriptor/web/WebXml.java b/java/org/apache/tomcat/util/descriptor/web/WebXml.java index 20c1df9..705b155 100644 --- a/java/org/apache/tomcat/util/descriptor/web/WebXml.java +++ b/java/org/apache/tomcat/util/descriptor/web/WebXml.java @@ -1371,7 +1371,9 @@ public class WebXml extends XmlEncodingBase implements DocumentProperties.Encodi private static void appendElement(StringBuilder sb, String indent, String elementName, Object value) { - if (value == null) return; + if (value == null) { + return; + } appendElement(sb, indent, elementName, value.toString()); } diff --git a/java/org/apache/tomcat/util/digester/Digester.java b/java/org/apache/tomcat/util/digester/Digester.java index cf455cf..035a588 100644 --- a/java/org/apache/tomcat/util/digester/Digester.java +++ b/java/org/apache/tomcat/util/digester/Digester.java @@ -1041,8 +1041,9 @@ public class Digester extends DefaultHandler2 { } try { stack.pop(); - if (stack.empty()) + if (stack.empty()) { namespaces.remove(prefix); + } } catch (EmptyStackException e) { throw createSAXException("endPrefixMapping popped too many times"); } diff --git a/java/org/apache/tomcat/util/http/RequestUtil.java b/java/org/apache/tomcat/util/http/RequestUtil.java index 2edd695..c8fb077 100644 --- a/java/org/apache/tomcat/util/http/RequestUtil.java +++ b/java/org/apache/tomcat/util/http/RequestUtil.java @@ -66,12 +66,14 @@ public class RequestUtil { // Create a place for the normalized path String normalized = path; - if (replaceBackSlash && normalized.indexOf('\\') >= 0) + if (replaceBackSlash && normalized.indexOf('\\') >= 0) { normalized = normalized.replace('\\', '/'); + } // Add a leading "/" if necessary - if (!normalized.startsWith("/")) + if (!normalized.startsWith("/")) { normalized = "/" + normalized; + } boolean addedTrailingSlash = false; if (normalized.endsWith("/.") || normalized.endsWith("/..")) { diff --git a/java/org/apache/tomcat/util/modeler/AttributeInfo.java b/java/org/apache/tomcat/util/modeler/AttributeInfo.java index 2893611..a2a00c4 100644 --- a/java/org/apache/tomcat/util/modeler/AttributeInfo.java +++ b/java/org/apache/tomcat/util/modeler/AttributeInfo.java @@ -56,8 +56,9 @@ public class AttributeInfo extends FeatureInfo { * @return the name of the property getter method, if non-standard. */ public String getGetMethod() { - if(getMethod == null) + if(getMethod == null) { getMethod = getMethodName(getName(), true, isIs()); + } return this.getMethod; } @@ -96,8 +97,9 @@ public class AttributeInfo extends FeatureInfo { * @return the name of the property setter method, if non-standard. */ public String getSetMethod() { - if( setMethod == null ) + if( setMethod == null ) { setMethod = getMethodName(getName(), false, false); + } return this.setMethod; } @@ -149,12 +151,14 @@ public class AttributeInfo extends FeatureInfo { private String getMethodName(String name, boolean getter, boolean is) { StringBuilder sb = new StringBuilder(); if (getter) { - if (is) + if (is) { sb.append("is"); - else + } else { sb.append("get"); - } else + } + } else { sb.append("set"); + } sb.append(Character.toUpperCase(name.charAt(0))); sb.append(name.substring(1)); return sb.toString(); diff --git a/java/org/apache/tomcat/util/modeler/BaseAttributeFilter.java b/java/org/apache/tomcat/util/modeler/BaseAttributeFilter.java index 17a0fe9..b2c82c2 100644 --- a/java/org/apache/tomcat/util/modeler/BaseAttributeFilter.java +++ b/java/org/apache/tomcat/util/modeler/BaseAttributeFilter.java @@ -50,8 +50,9 @@ public class BaseAttributeFilter implements NotificationFilter { public BaseAttributeFilter(String name) { super(); - if (name != null) + if (name != null) { addAttribute(name); + } } @@ -124,19 +125,23 @@ public class BaseAttributeFilter implements NotificationFilter { @Override public boolean isNotificationEnabled(Notification notification) { - if (notification == null) + if (notification == null) { return false; - if (!(notification instanceof AttributeChangeNotification)) + } + if (!(notification instanceof AttributeChangeNotification)) { return false; + } AttributeChangeNotification acn = (AttributeChangeNotification) notification; - if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType())) + if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType())) { return false; + } synchronized (names) { - if (names.size() < 1) + if (names.size() < 1) { return true; - else + } else { return names.contains(acn.getAttributeName()); + } } } diff --git a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java index db66c5f..e25c874 100644 --- a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java +++ b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java @@ -153,10 +153,11 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, throws AttributeNotFoundException, MBeanException, ReflectionException { // Validate the input parameters - if (name == null) + if (name == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Attribute name is null"), "Attribute name is null"); + } if( (resource instanceof DynamicMBean) && ! ( resource instanceof BaseModelMBean )) { @@ -176,17 +177,19 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, } } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); - if (t == null) + if (t == null) { t = e; - if (t instanceof RuntimeException) + } + if (t instanceof RuntimeException) { throw new RuntimeOperationsException ((RuntimeException) t, "Exception invoking method " + name); - else if (t instanceof Error) + } else if (t instanceof Error) { throw new RuntimeErrorException ((Error) t, "Error invoking method " + name); - else + } else { throw new MBeanException (e, "Exception invoking method " + name); + } } catch (Exception e) { throw new MBeanException (e, "Exception invoking method " + name); @@ -207,10 +210,11 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, public AttributeList getAttributes(String names[]) { // Validate the input parameters - if (names == null) + if (names == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Attribute names list is null"), "Attribute names list is null"); + } // Prepare our response, eating all exceptions AttributeList response = new AttributeList(); @@ -268,12 +272,15 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, } // Validate the input parameters - if (name == null) + if (name == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Method name is null"), "Method name is null"); + } - if( log.isDebugEnabled()) log.debug("Invoke " + name); + if( log.isDebugEnabled()) { + log.debug("Invoke " + name); + } Method method= managedBean.getInvoke(name, params, signature, this, resource); @@ -288,17 +295,19 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); log.error("Exception invoking method " + name , t ); - if (t == null) + if (t == null) { t = e; - if (t instanceof RuntimeException) + } + if (t instanceof RuntimeException) { throw new RuntimeOperationsException ((RuntimeException) t, "Exception invoking method " + name); - else if (t instanceof Error) + } else if (t instanceof Error) { throw new RuntimeErrorException ((Error) t, "Error invoking method " + name); - else + } else { throw new MBeanException ((Exception)t, "Exception invoking method " + name); + } } catch (Exception e) { log.error("Exception invoking method " + name , e ); throw new MBeanException @@ -314,27 +323,28 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, static Class<?> getAttributeClass(String signature) throws ReflectionException { - if (signature.equals(Boolean.TYPE.getName())) + if (signature.equals(Boolean.TYPE.getName())) { return Boolean.TYPE; - else if (signature.equals(Byte.TYPE.getName())) + } else if (signature.equals(Byte.TYPE.getName())) { return Byte.TYPE; - else if (signature.equals(Character.TYPE.getName())) + } else if (signature.equals(Character.TYPE.getName())) { return Character.TYPE; - else if (signature.equals(Double.TYPE.getName())) + } else if (signature.equals(Double.TYPE.getName())) { return Double.TYPE; - else if (signature.equals(Float.TYPE.getName())) + } else if (signature.equals(Float.TYPE.getName())) { return Float.TYPE; - else if (signature.equals(Integer.TYPE.getName())) + } else if (signature.equals(Integer.TYPE.getName())) { return Integer.TYPE; - else if (signature.equals(Long.TYPE.getName())) + } else if (signature.equals(Long.TYPE.getName())) { return Long.TYPE; - else if (signature.equals(Short.TYPE.getName())) + } else if (signature.equals(Short.TYPE.getName())) { return Short.TYPE; - else { + } else { try { ClassLoader cl=Thread.currentThread().getContextClassLoader(); - if( cl!=null ) + if( cl!=null ) { return cl.loadClass(signature); + } } catch( ClassNotFoundException e ) { } try { @@ -364,8 +374,9 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, throws AttributeNotFoundException, MBeanException, ReflectionException { - if( log.isDebugEnabled() ) + if( log.isDebugEnabled() ) { log.debug("Setting attribute " + this + " " + attribute ); + } if( (resource instanceof DynamicMBean) && ! ( resource instanceof BaseModelMBean )) { @@ -378,18 +389,20 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, } // Validate the input parameters - if (attribute == null) + if (attribute == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Attribute is null"), "Attribute is null"); + } String name = attribute.getName(); Object value = attribute.getValue(); - if (name == null) + if (name == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Attribute name is null"), "Attribute name is null"); + } Object oldValue=null; //if( getAttMap.get(name) != null ) @@ -405,17 +418,19 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, } } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); - if (t == null) + if (t == null) { t = e; - if (t instanceof RuntimeException) + } + if (t instanceof RuntimeException) { throw new RuntimeOperationsException ((RuntimeException) t, "Exception invoking method " + name); - else if (t instanceof Error) + } else if (t instanceof Error) { throw new RuntimeErrorException ((Error) t, "Error invoking method " + name); - else + } else { throw new MBeanException (e, "Exception invoking method " + name); + } } catch (Exception e) { log.error("Exception invoking method " + name , e ); throw new MBeanException @@ -436,8 +451,9 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, @Override public String toString() { - if( resource==null ) + if( resource==null ) { return "BaseModelMbean[" + resourceType + "]"; + } return resource.toString(); } @@ -453,8 +469,9 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, AttributeList response = new AttributeList(); // Validate the input parameters - if (attributes == null) + if (attributes == null) { return response; + } // Prepare and return our response, eating all exceptions String names[] = new String[attributes.size()]; @@ -495,10 +512,11 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, throws InstanceNotFoundException, InvalidTargetObjectTypeException, MBeanException, RuntimeOperationsException { - if (resource == null) + if (resource == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Managed resource is null"), "Managed resource is null"); + } return resource; @@ -528,10 +546,11 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, throws InstanceNotFoundException, MBeanException, RuntimeOperationsException { - if (resource == null) + if (resource == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Managed resource is null"), "Managed resource is null"); + } // if (!"objectreference".equalsIgnoreCase(type)) // throw new InvalidTargetObjectTypeException(type); @@ -573,13 +592,16 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, (NotificationListener listener, String name, Object handback) throws IllegalArgumentException { - if (listener == null) + if (listener == null) { throw new IllegalArgumentException("Listener is null"); - if (attributeBroadcaster == null) + } + if (attributeBroadcaster == null) { attributeBroadcaster = new BaseNotificationBroadcaster(); + } - if( log.isDebugEnabled() ) + if( log.isDebugEnabled() ) { log.debug("addAttributeNotificationListener " + listener); + } BaseAttributeFilter filter = new BaseAttributeFilter(name); attributeBroadcaster.addNotificationListener @@ -604,8 +626,9 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, (NotificationListener listener, String name) throws ListenerNotFoundException { - if (listener == null) + if (listener == null) { throw new IllegalArgumentException("Listener is null"); + } // FIXME - currently this removes *all* notifications for this listener if (attributeBroadcaster != null) { @@ -632,14 +655,18 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, (AttributeChangeNotification notification) throws MBeanException, RuntimeOperationsException { - if (notification == null) + if (notification == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Notification is null"), "Notification is null"); + } if (attributeBroadcaster == null) + { return; // This means there are no registered listeners - if( log.isDebugEnabled() ) + } + if( log.isDebugEnabled() ) { log.debug( "AttributeChangeNotification " + notification ); + } attributeBroadcaster.sendNotification(notification); } @@ -664,12 +691,14 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, // Calculate the class name for the change notification String type = null; - if (newValue.getValue() != null) + if (newValue.getValue() != null) { type = newValue.getValue().getClass().getName(); - else if (oldValue.getValue() != null) + } else if (oldValue.getValue() != null) { type = oldValue.getValue().getClass().getName(); - else + } + else { return; // Old and new are both null == no change + } AttributeChangeNotification notification = new AttributeChangeNotification @@ -697,12 +726,15 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, public void sendNotification(Notification notification) throws MBeanException, RuntimeOperationsException { - if (notification == null) + if (notification == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Notification is null"), "Notification is null"); + } if (generalBroadcaster == null) + { return; // This means there are no registered listeners + } generalBroadcaster.sendNotification(notification); } @@ -723,10 +755,11 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, public void sendNotification(String message) throws MBeanException, RuntimeOperationsException { - if (message == null) + if (message == null) { throw new RuntimeOperationsException (new IllegalArgumentException("Message is null"), "Message is null"); + } Notification notification = new Notification ("jmx.modelmbean.generic", this, 1, message); sendNotification(notification); @@ -754,13 +787,17 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, Object handback) throws IllegalArgumentException { - if (listener == null) + if (listener == null) { throw new IllegalArgumentException("Listener is null"); + } - if( log.isDebugEnabled() ) log.debug("addNotificationListener " + listener); + if( log.isDebugEnabled() ) { + log.debug("addNotificationListener " + listener); + } - if (generalBroadcaster == null) + if (generalBroadcaster == null) { generalBroadcaster = new BaseNotificationBroadcaster(); + } generalBroadcaster.addNotificationListener (listener, filter, handback); @@ -768,11 +805,13 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, // The normal filtering can be used. // The problem is that there is no other way to add attribute change listeners // to a model mbean ( AFAIK ). I suppose the spec should be fixed. - if (attributeBroadcaster == null) + if (attributeBroadcaster == null) { attributeBroadcaster = new BaseNotificationBroadcaster(); + } - if( log.isDebugEnabled() ) + if( log.isDebugEnabled() ) { log.debug("addAttributeNotificationListener " + listener); + } attributeBroadcaster.addNotificationListener (listener, filter, handback); @@ -838,8 +877,9 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { - if (listener == null) + if (listener == null) { throw new IllegalArgumentException("Listener is null"); + } if (generalBroadcaster != null) { generalBroadcaster.removeNotificationListener(listener); @@ -881,8 +921,9 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ObjectName name) throws Exception { - if( log.isDebugEnabled()) + if( log.isDebugEnabled()) { log.debug("preRegister " + resource + " " + name ); + } oname=name; if( resource instanceof MBeanRegistration ) { oname = ((MBeanRegistration)resource).preRegister(server, name ); diff --git a/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java b/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java index 9795cf8..c621eb1 100644 --- a/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java +++ b/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java @@ -95,7 +95,9 @@ public class BaseNotificationBroadcaster implements NotificationBroadcaster { oldFilter.clear(); } else { if (oldNames.length != 0) { - for (String newName : newNames) oldFilter.addAttribute(newName); + for (String newName : newNames) { + oldFilter.addAttribute(newName); + } } } return; @@ -157,8 +159,9 @@ public class BaseNotificationBroadcaster implements NotificationBroadcaster { synchronized (entries) { for (BaseNotificationBroadcasterEntry item : entries) { if ((item.filter != null) && - (!item.filter.isNotificationEnabled(notification))) + (!item.filter.isNotificationEnabled(notification))) { continue; + } item.listener.handleNotification(notification, item.handback); } } diff --git a/java/org/apache/tomcat/util/modeler/ManagedBean.java b/java/org/apache/tomcat/util/modeler/ManagedBean.java index 8fd898e..1f248a0 100644 --- a/java/org/apache/tomcat/util/modeler/ManagedBean.java +++ b/java/org/apache/tomcat/util/modeler/ManagedBean.java @@ -306,8 +306,9 @@ public class ManagedBean implements java.io.Serializable { if( clazz==null ) { try { ClassLoader cl= Thread.currentThread().getContextClassLoader(); - if ( cl != null) + if ( cl != null) { clazz= cl.loadClass(getClassName()); + } } catch (Exception e) { ex=e; } @@ -333,8 +334,9 @@ public class ManagedBean implements java.io.Serializable { // Set the managed resource (if any) try { - if (instance != null) + if (instance != null) { mbean.setManagedResource(instance, "ObjectReference"); + } } catch (InstanceNotFoundException e) { throw e; } @@ -367,21 +369,24 @@ public class ManagedBean implements java.io.Serializable { AttributeInfo attrs[] = getAttributes(); MBeanAttributeInfo attributes[] = new MBeanAttributeInfo[attrs.length]; - for (int i = 0; i < attrs.length; i++) + for (int i = 0; i < attrs.length; i++) { attributes[i] = attrs[i].createAttributeInfo(); + } OperationInfo opers[] = getOperations(); MBeanOperationInfo operations[] = new MBeanOperationInfo[opers.length]; - for (int i = 0; i < opers.length; i++) + for (int i = 0; i < opers.length; i++) { operations[i] = opers[i].createOperationInfo(); + } NotificationInfo notifs[] = getNotifications(); MBeanNotificationInfo notifications[] = new MBeanNotificationInfo[notifs.length]; - for (int i = 0; i < notifs.length; i++) + for (int i = 0; i < notifs.length; i++) { notifications[i] = notifs[i].createNotificationInfo(); + } // Construct and return a new ModelMBeanInfo object @@ -431,12 +436,14 @@ public class ManagedBean implements java.io.Serializable { AttributeInfo attrInfo = attributes.get(aname); // Look up the actual operation to be used - if (attrInfo == null) + if (attrInfo == null) { throw new AttributeNotFoundException(" Cannot find attribute " + aname + " for " + resource); + } String getMethod = attrInfo.getGetMethod(); - if (getMethod == null) + if (getMethod == null) { throw new AttributeNotFoundException("Cannot find attribute " + aname + " get method name"); + } Object object = null; NoSuchMethodException exception = null; @@ -455,9 +462,10 @@ public class ManagedBean implements java.io.Serializable { exception = e; } } - if (exception != null) + if (exception != null) { throw new ReflectionException(exception, "Cannot find getter method " + getMethod); + } return m; } @@ -468,13 +476,15 @@ public class ManagedBean implements java.io.Serializable { Method m = null; AttributeInfo attrInfo = attributes.get(aname); - if (attrInfo == null) + if (attrInfo == null) { throw new AttributeNotFoundException(" Cannot find attribute " + aname); + } // Look up the actual operation to be used String setMethod = attrInfo.getSetMethod(); - if (setMethod == null) + if (setMethod == null) { throw new AttributeNotFoundException("Cannot find attribute " + aname + " set method name"); + } String argType=attrInfo.getType(); @@ -498,10 +508,11 @@ public class ManagedBean implements java.io.Serializable { exception = e; } } - if (exception != null) + if (exception != null) { throw new ReflectionException(exception, "Cannot find setter method " + setMethod + " " + resource); + } return m; } @@ -511,24 +522,28 @@ public class ManagedBean implements java.io.Serializable { Method method = null; - if (params == null) + if (params == null) { params = new Object[0]; - if (signature == null) + } + if (signature == null) { signature = new String[0]; - if (params.length != signature.length) + } + if (params.length != signature.length) { throw new RuntimeOperationsException( new IllegalArgumentException( "Inconsistent arguments and signature"), "Inconsistent arguments and signature"); + } // Acquire the ModelMBeanOperationInfo information for // the requested operation OperationInfo opInfo = operations.get(createOperationKey(aname, signature)); - if (opInfo == null) + if (opInfo == null) { throw new MBeanException(new ServiceNotFoundException( "Cannot find operation " + aname), "Cannot find operation " + aname); + } // Prepare the signature required by Java reflection APIs // FIXME - should we use the signature from opInfo? diff --git a/java/org/apache/tomcat/util/modeler/NotificationInfo.java b/java/org/apache/tomcat/util/modeler/NotificationInfo.java index 18f5524..c5c78fb 100644 --- a/java/org/apache/tomcat/util/modeler/NotificationInfo.java +++ b/java/org/apache/tomcat/util/modeler/NotificationInfo.java @@ -117,8 +117,9 @@ public class NotificationInfo extends FeatureInfo { public MBeanNotificationInfo createNotificationInfo() { // Return our cached information (if any) - if (info != null) + if (info != null) { return info; + } // Create and return a new information object info = new MBeanNotificationInfo diff --git a/java/org/apache/tomcat/util/modeler/OperationInfo.java b/java/org/apache/tomcat/util/modeler/OperationInfo.java index 6a63870..c5dbdee 100644 --- a/java/org/apache/tomcat/util/modeler/OperationInfo.java +++ b/java/org/apache/tomcat/util/modeler/OperationInfo.java @@ -64,10 +64,11 @@ public class OperationInfo extends FeatureInfo { } public void setImpact(String impact) { - if (impact == null) + if (impact == null) { this.impact = null; - else + } else { this.impact = impact.toUpperCase(Locale.ENGLISH); + } } @@ -147,12 +148,13 @@ public class OperationInfo extends FeatureInfo { if (info == null) { // Create and return a new information object int impact = MBeanOperationInfo.UNKNOWN; - if ("ACTION".equals(getImpact())) + if ("ACTION".equals(getImpact())) { impact = MBeanOperationInfo.ACTION; - else if ("ACTION_INFO".equals(getImpact())) + } else if ("ACTION_INFO".equals(getImpact())) { impact = MBeanOperationInfo.ACTION_INFO; - else if ("INFO".equals(getImpact())) + } else if ("INFO".equals(getImpact())) { impact = MBeanOperationInfo.INFO; + } info = new MBeanOperationInfo(getName(), getDescription(), getMBeanParameterInfo(), @@ -165,8 +167,9 @@ public class OperationInfo extends FeatureInfo { ParameterInfo params[] = getSignature(); MBeanParameterInfo parameters[] = new MBeanParameterInfo[params.length]; - for (int i = 0; i < params.length; i++) + for (int i = 0; i < params.length; i++) { parameters[i] = params[i].createParameterInfo(); + } return parameters; } } diff --git a/java/org/apache/tomcat/util/modeler/Registry.java b/java/org/apache/tomcat/util/modeler/Registry.java index 545a5ca..dab256b 100644 --- a/java/org/apache/tomcat/util/modeler/Registry.java +++ b/java/org/apache/tomcat/util/modeler/Registry.java @@ -238,8 +238,9 @@ public class Registry implements RegistryMBean, MBeanRegistration { getMBeanServer().invoke(current, operation, new Object[] {}, new String[] {}); } catch (Exception t) { - if (failFirst) + if (failFirst) { throw t; + } log.info("Error initializing " + current + " " + t.toString()); } } @@ -317,8 +318,9 @@ public class Registry implements RegistryMBean, MBeanRegistration { public ManagedBean findManagedBean(String name) { // XXX Group ?? Use Group + Type ManagedBean mb = descriptors.get(name); - if (mb == null) + if (mb == null) { mb = descriptorsByClass.get(name); + } return mb; } @@ -697,8 +699,9 @@ public class Registry implements RegistryMBean, MBeanRegistration { String pkg = className; while (pkg.indexOf('.') > 0) { int lastComp = pkg.lastIndexOf('.'); - if (lastComp <= 0) + if (lastComp <= 0) { return; + } pkg = pkg.substring(0, lastComp); if (searchedPaths.get(pkg) != null) { return; @@ -709,8 +712,9 @@ public class Registry implements RegistryMBean, MBeanRegistration { private ModelerSource getModelerSource(String type) throws Exception { - if (type == null) + if (type == null) { type = "MbeansDescriptorsDigesterSource"; + } if (!type.contains(".")) { type = "org.apache.tomcat.util.modeler.modules." + type; } diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java index 72809e7..40dc24f 100644 --- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java +++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java @@ -73,11 +73,15 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource } public void execute() throws Exception { - if( registry==null ) registry=Registry.getRegistry(null, null); + if( registry==null ) { + registry=Registry.getRegistry(null, null); + } try { ManagedBean managed = createManagedBean(registry, null, (Class<?>)source, type); - if( managed==null ) return; + if( managed==null ) { + return; + } managed.setName( type ); registry.addManagedBean(managed); @@ -315,26 +319,33 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource //ai.setGetMethodObj( gm ); ai.setGetMethod( gm.getName()); Class<?> t=gm.getReturnType(); - if( t!=null ) + if( t!=null ) { ai.setType( t.getName() ); + } } Method sm = setAttMap.get(name); if( sm!=null ) { //ai.setSetMethodObj(sm); Class<?> t = sm.getParameterTypes()[0]; - if( t!=null ) + if( t!=null ) { ai.setType( t.getName()); + } ai.setSetMethod( sm.getName()); } ai.setDescription("Introspected attribute " + name); - if( log.isDebugEnabled()) log.debug("Introspected attribute " + - name + " " + gm + " " + sm); - if( gm==null ) + if( log.isDebugEnabled()) { + log.debug("Introspected attribute " + + name + " " + gm + " " + sm); + } + if( gm==null ) { ai.setReadable(false); - if( sm==null ) + } + if( sm==null ) { ai.setWriteable(false); - if( sm!=null || gm!=null ) + } + if( sm!=null || gm!=null ) { mbean.addAttribute(ai); + } } // This map is populated by iterating the methods (which end up as @@ -359,8 +370,9 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource mbean.addOperation(op); } - if( log.isDebugEnabled()) + if( log.isDebugEnabled()) { log.debug("Setting name: " + type ); + } mbean.setName( type ); return mbean; diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index b950909..9aad8c2 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -566,7 +566,9 @@ public abstract class AbstractEndpoint<S> { * is 100. */ private int acceptCount = 100; - public void setAcceptCount(int acceptCount) { if (acceptCount > 0) this.acceptCount = acceptCount; } + public void setAcceptCount(int acceptCount) { if (acceptCount > 0) { + this.acceptCount = acceptCount; + } } public int getAcceptCount() { return acceptCount; } @Deprecated public void setBacklog(int backlog) { setAcceptCount(backlog); } @@ -981,10 +983,12 @@ public abstract class AbstractEndpoint<S> { try (java.net.Socket s = new java.net.Socket()) { int stmo = 2 * 1000; int utmo = 2 * 1000; - if (getSocketProperties().getSoTimeout() > stmo) + if (getSocketProperties().getSoTimeout() > stmo) { stmo = getSocketProperties().getSoTimeout(); - if (getSocketProperties().getUnlockTimeout() > utmo) + } + if (getSocketProperties().getUnlockTimeout() > utmo) { utmo = getSocketProperties().getUnlockTimeout(); + } s.setSoTimeout(stmo); s.setSoLinger(getSocketProperties().getSoLingerOn(),getSocketProperties().getSoLingerTime()); if (getLog().isDebugEnabled()) { @@ -1288,7 +1292,9 @@ public abstract class AbstractEndpoint<S> { protected abstract Log getLog(); protected LimitLatch initializeConnectionLatch() { - if (maxConnections==-1) return null; + if (maxConnections==-1) { + return null; + } if (connectionLimitLatch==null) { connectionLimitLatch = new LimitLatch(getMaxConnections()); } @@ -1297,18 +1303,26 @@ public abstract class AbstractEndpoint<S> { protected void releaseConnectionLatch() { LimitLatch latch = connectionLimitLatch; - if (latch!=null) latch.releaseAll(); + if (latch!=null) { + latch.releaseAll(); + } connectionLimitLatch = null; } protected void countUpOrAwaitConnection() throws InterruptedException { - if (maxConnections==-1) return; + if (maxConnections==-1) { + return; + } LimitLatch latch = connectionLimitLatch; - if (latch!=null) latch.countUpOrAwait(); + if (latch!=null) { + latch.countUpOrAwait(); + } } protected long countDownConnection() { - if (maxConnections==-1) return -1; + if (maxConnections==-1) { + return -1; + } LimitLatch latch = connectionLimitLatch; if (latch!=null) { long result = latch.countDown(); @@ -1316,7 +1330,9 @@ public abstract class AbstractEndpoint<S> { getLog().warn(sm.getString("endpoint.warn.incorrectConnectionCount")); } return result; - } else return -1; + } else { + return -1; + } } /** diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 3e3b2c9..34e05ec 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -616,10 +616,12 @@ public class AprEndpoint extends AbstractEndpoint<Long> implements SNICallBack { try { // 1: Set socket options: timeout, linger, etc - if (socketProperties.getSoLingerOn() && socketProperties.getSoLingerTime() >= 0) + if (socketProperties.getSoLingerOn() && socketProperties.getSoLingerTime() >= 0) { Socket.optSet(socket, Socket.APR_SO_LINGER, socketProperties.getSoLingerTime()); - if (socketProperties.getTcpNoDelay()) + } + if (socketProperties.getTcpNoDelay()) { Socket.optSet(socket, Socket.APR_TCP_NODELAY, (socketProperties.getTcpNoDelay() ? 1 : 0)); + } Socket.timeoutSet(socket, socketProperties.getSoTimeout() * 1000); // 2: SSL handshake diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index b32b856..252b1d6 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1616,7 +1616,9 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel> { } } catch (IOException x) { handshake = -1; - if (log.isDebugEnabled()) log.debug("Error during SSL handshake",x); + if (log.isDebugEnabled()) { + log.debug("Error during SSL handshake",x); + } } catch (CancelledKeyException ckx) { handshake = -1; } diff --git a/java/org/apache/tomcat/util/net/SSLImplementation.java b/java/org/apache/tomcat/util/net/SSLImplementation.java index 4bafd25..2043e8a 100644 --- a/java/org/apache/tomcat/util/net/SSLImplementation.java +++ b/java/org/apache/tomcat/util/net/SSLImplementation.java @@ -51,8 +51,9 @@ public abstract class SSLImplementation { */ public static SSLImplementation getInstance(String className) throws ClassNotFoundException { - if (className == null) + if (className == null) { return new JSSEImplementation(); + } try { Class<?> clazz = Class.forName(className); diff --git a/java/org/apache/tomcat/util/net/SecureNio2Channel.java b/java/org/apache/tomcat/util/net/SecureNio2Channel.java index 49768e4..1f537e4 100644 --- a/java/org/apache/tomcat/util/net/SecureNio2Channel.java +++ b/java/org/apache/tomcat/util/net/SecureNio2Channel.java @@ -289,8 +289,9 @@ public class SecureNio2Channel extends Nio2Channel { handshake = handshakeWrap(); } if (handshake.getStatus() == Status.OK) { - if (handshakeStatus == HandshakeStatus.NEED_TASK) + if (handshakeStatus == HandshakeStatus.NEED_TASK) { handshakeStatus = tasks(); + } } else if (handshake.getStatus() == Status.CLOSED) { return -1; } else { @@ -323,8 +324,9 @@ public class SecureNio2Channel extends Nio2Channel { //perform the unwrap function handshake = handshakeUnwrap(); if (handshake.getStatus() == Status.OK) { - if (handshakeStatus == HandshakeStatus.NEED_TASK) + if (handshakeStatus == HandshakeStatus.NEED_TASK) { handshakeStatus = tasks(); + } } else if (handshake.getStatus() == Status.BUFFER_UNDERFLOW) { if (netInBuffer.position() == netInBuffer.limit()) { //clear the buffer if we have emptied it out on data @@ -476,10 +478,18 @@ public class SecureNio2Channel extends Nio2Channel { */ public void rehandshake() throws IOException { //validate the network buffers are empty - if (netInBuffer.position() > 0 && netInBuffer.position() < netInBuffer.limit()) throw new IOException(sm.getString("channel.nio.ssl.netInputNotEmpty")); - if (netOutBuffer.position() > 0 && netOutBuffer.position() < netOutBuffer.limit()) throw new IOException(sm.getString("channel.nio.ssl.netOutputNotEmpty")); - if (!getBufHandler().isReadBufferEmpty()) throw new IOException(sm.getString("channel.nio.ssl.appInputNotEmpty")); - if (!getBufHandler().isWriteBufferEmpty()) throw new IOException(sm.getString("channel.nio.ssl.appOutputNotEmpty")); + if (netInBuffer.position() > 0 && netInBuffer.position() < netInBuffer.limit()) { + throw new IOException(sm.getString("channel.nio.ssl.netInputNotEmpty")); + } + if (netOutBuffer.position() > 0 && netOutBuffer.position() < netOutBuffer.limit()) { + throw new IOException(sm.getString("channel.nio.ssl.netOutputNotEmpty")); + } + if (!getBufHandler().isReadBufferEmpty()) { + throw new IOException(sm.getString("channel.nio.ssl.appInputNotEmpty")); + } + if (!getBufHandler().isWriteBufferEmpty()) { + throw new IOException(sm.getString("channel.nio.ssl.appOutputNotEmpty")); + } netOutBuffer.position(0); netOutBuffer.limit(0); @@ -727,11 +737,13 @@ public class SecureNio2Channel extends Nio2Channel { } private Integer unwrap(int nRead, long timeout, TimeUnit unit) throws ExecutionException, TimeoutException, InterruptedException { //are we in the middle of closing or closed? - if (closing || closed) + if (closing || closed) { return Integer.valueOf(-1); + } //did we reach EOF? if so send EOF up one layer. - if (nRead < 0) + if (nRead < 0) { return Integer.valueOf(-1); + } //the data read int read = 0; //the SSL engine result @@ -886,8 +898,9 @@ public class SecureNio2Channel extends Nio2Channel { written = result.bytesConsumed(); netOutBuffer.flip(); if (result.getStatus() == Status.OK) { - if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) + if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); + } } else { t = new IOException(sm.getString("channel.nio.ssl.wrapFail", result.getStatus())); } @@ -945,8 +958,9 @@ public class SecureNio2Channel extends Nio2Channel { //we did receive some data, add it to our total read += unwrap.bytesProduced(); //perform any tasks if needed - if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) + if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); + } //if we need more network data, then bail out for now. if (unwrap.getStatus() == Status.BUFFER_UNDERFLOW) { if (read == 0) { @@ -1059,8 +1073,9 @@ public class SecureNio2Channel extends Nio2Channel { read -= dsts2[dsts.length].position(); } //perform any tasks if needed - if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) + if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); + } //if we need more network data, then bail out for now. if (unwrap.getStatus() == Status.BUFFER_UNDERFLOW) { if (read == 0) { diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java b/java/org/apache/tomcat/util/net/SecureNioChannel.java index a38ec47..fdc87d2 100644 --- a/java/org/apache/tomcat/util/net/SecureNioChannel.java +++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java @@ -857,7 +857,9 @@ public class SecureNioChannel extends NioChannel { netOutBuffer.flip(); if (result.getStatus() == Status.OK) { - if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); + if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { + tasks(); + } } else { throw new IOException(sm.getString("channel.nio.ssl.wrapFail", result.getStatus())); } diff --git a/java/org/apache/tomcat/util/net/SocketProperties.java b/java/org/apache/tomcat/util/net/SocketProperties.java index 706cc5e..89e2e5b 100644 --- a/java/org/apache/tomcat/util/net/SocketProperties.java +++ b/java/org/apache/tomcat/util/net/SocketProperties.java @@ -179,27 +179,35 @@ public class SocketProperties { public void setProperties(Socket socket) throws SocketException{ - if (rxBufSize != null) + if (rxBufSize != null) { socket.setReceiveBufferSize(rxBufSize.intValue()); - if (txBufSize != null) + } + if (txBufSize != null) { socket.setSendBufferSize(txBufSize.intValue()); - if (ooBInline !=null) + } + if (ooBInline !=null) { socket.setOOBInline(ooBInline.booleanValue()); - if (soKeepAlive != null) + } + if (soKeepAlive != null) { socket.setKeepAlive(soKeepAlive.booleanValue()); + } if (performanceConnectionTime != null && performanceLatency != null && - performanceBandwidth != null) + performanceBandwidth != null) { socket.setPerformancePreferences( performanceConnectionTime.intValue(), performanceLatency.intValue(), performanceBandwidth.intValue()); - if (soReuseAddress != null) + } + if (soReuseAddress != null) { socket.setReuseAddress(soReuseAddress.booleanValue()); - if (soLingerOn != null && soLingerTime != null) + } + if (soLingerOn != null && soLingerTime != null) { socket.setSoLinger(soLingerOn.booleanValue(), soLingerTime.intValue()); - if (soTimeout != null && soTimeout.intValue() >= 0) + } + if (soTimeout != null && soTimeout.intValue() >= 0) { socket.setSoTimeout(soTimeout.intValue()); + } if (tcpNoDelay != null) { try { socket.setTcpNoDelay(tcpNoDelay.booleanValue()); @@ -210,40 +218,52 @@ public class SocketProperties { } public void setProperties(ServerSocket socket) throws SocketException{ - if (rxBufSize != null) + if (rxBufSize != null) { socket.setReceiveBufferSize(rxBufSize.intValue()); + } if (performanceConnectionTime != null && performanceLatency != null && - performanceBandwidth != null) + performanceBandwidth != null) { socket.setPerformancePreferences( performanceConnectionTime.intValue(), performanceLatency.intValue(), performanceBandwidth.intValue()); - if (soReuseAddress != null) + } + if (soReuseAddress != null) { socket.setReuseAddress(soReuseAddress.booleanValue()); - if (soTimeout != null && soTimeout.intValue() >= 0) + } + if (soTimeout != null && soTimeout.intValue() >= 0) { socket.setSoTimeout(soTimeout.intValue()); + } } public void setProperties(AsynchronousSocketChannel socket) throws IOException { - if (rxBufSize != null) + if (rxBufSize != null) { socket.setOption(StandardSocketOptions.SO_RCVBUF, rxBufSize); - if (txBufSize != null) + } + if (txBufSize != null) { socket.setOption(StandardSocketOptions.SO_SNDBUF, txBufSize); - if (soKeepAlive != null) + } + if (soKeepAlive != null) { socket.setOption(StandardSocketOptions.SO_KEEPALIVE, soKeepAlive); - if (soReuseAddress != null) + } + if (soReuseAddress != null) { socket.setOption(StandardSocketOptions.SO_REUSEADDR, soReuseAddress); - if (soLingerOn != null && soLingerOn.booleanValue() && soLingerTime != null) + } + if (soLingerOn != null && soLingerOn.booleanValue() && soLingerTime != null) { socket.setOption(StandardSocketOptions.SO_LINGER, soLingerTime); - if (tcpNoDelay != null) + } + if (tcpNoDelay != null) { socket.setOption(StandardSocketOptions.TCP_NODELAY, tcpNoDelay); + } } public void setProperties(AsynchronousServerSocketChannel socket) throws IOException { - if (rxBufSize != null) + if (rxBufSize != null) { socket.setOption(StandardSocketOptions.SO_RCVBUF, rxBufSize); - if (soReuseAddress != null) + } + if (soReuseAddress != null) { socket.setOption(StandardSocketOptions.SO_REUSEADDR, soReuseAddress); + } } public boolean getDirectBuffer() { diff --git a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java index 5d15e2c..16c669b 100644 --- a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java +++ b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java @@ -95,16 +95,18 @@ public class JSSESupport implements SSLSupport, SSLSessionManager { @Override public String getCipherSuite() throws IOException { // Look up the current SSLSession - if (session == null) + if (session == null) { return null; + } return session.getCipherSuite(); } @Override public java.security.cert.X509Certificate[] getPeerCertificateChain() throws IOException { // Look up the current SSLSession - if (session == null) + if (session == null) { return null; + } Certificate [] certs=null; try { @@ -113,7 +115,9 @@ public class JSSESupport implements SSLSupport, SSLSessionManager { log.debug(sm.getString("jsseSupport.clientCertError"), t); return null; } - if( certs==null ) return null; + if( certs==null ) { + return null; + } java.security.cert.X509Certificate [] x509Certs = new java.security.cert.X509Certificate[certs.length]; @@ -136,11 +140,13 @@ public class JSSESupport implements SSLSupport, SSLSessionManager { return null; } } - if(log.isTraceEnabled()) + if(log.isTraceEnabled()) { log.trace("Cert #" + i + " = " + x509Certs[i]); + } } - if(x509Certs.length < 1) + if(x509Certs.length < 1) { return null; + } return x509Certs; } @@ -164,17 +170,23 @@ public class JSSESupport implements SSLSupport, SSLSessionManager { public String getSessionId() throws IOException { // Look up the current SSLSession - if (session == null) + if (session == null) { return null; + } // Expose ssl_session (getId) byte [] ssl_session = session.getId(); - if ( ssl_session == null) + if ( ssl_session == null) { return null; + } StringBuilder buf=new StringBuilder(); for (byte b : ssl_session) { String digit = Integer.toHexString(b); - if (digit.length() < 2) buf.append('0'); - if (digit.length() > 2) digit = digit.substring(digit.length() - 2); + if (digit.length() < 2) { + buf.append('0'); + } + if (digit.length() > 2) { + digit = digit.substring(digit.length() - 2); + } buf.append(digit); } return buf.toString(); diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java index 4ff955a..8110ff1 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -117,8 +117,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { OpenSSLConf openSslConf = sslHostConfig.getOpenSslConf(); if (openSslConf != null) { try { - if (log.isDebugEnabled()) + if (log.isDebugEnabled()) { log.debug(sm.getString("openssl.makeConf")); + } cctx = SSLConf.make(aprPool, SSL.SSL_CONF_FLAG_FILE | SSL.SSL_CONF_FLAG_SERVER | @@ -294,8 +295,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { // an acceptable certificate for (X509Certificate caCert : x509TrustManager.getAcceptedIssuers()) { SSLContext.addClientCACertificateRaw(ctx, caCert.getEncoded()); - if (log.isDebugEnabled()) + if (log.isDebugEnabled()) { log.debug(sm.getString("openssl.addedClientCaCert", caCert.toString())); + } } } else { // Client certificate verification based on trusted CA files and dirs @@ -316,8 +318,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { OpenSSLConf openSslConf = sslHostConfig.getOpenSslConf(); if (openSslConf != null && cctx != 0) { // Check OpenSSLConfCmd if used - if (log.isDebugEnabled()) + if (log.isDebugEnabled()) { log.debug(sm.getString("openssl.checkConf")); + } try { if (!openSslConf.check(cctx)) { log.error(sm.getString("openssl.errCheckConf")); @@ -326,8 +329,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { } catch (Exception e) { throw new Exception(sm.getString("openssl.errCheckConf"), e); } - if (log.isDebugEnabled()) + if (log.isDebugEnabled()) { log.debug(sm.getString("openssl.applyConf")); + } try { if (!openSslConf.apply(cctx, ctx)) { log.error(sm.getString("openssl.errApplyConf")); diff --git a/java/org/apache/tomcat/util/net/openssl/ciphers/OpenSSLCipherConfigurationParser.java b/java/org/apache/tomcat/util/net/openssl/ciphers/OpenSSLCipherConfigurationParser.java index f87b5f1..2f16e3a 100644 --- a/java/org/apache/tomcat/util/net/openssl/ciphers/OpenSSLCipherConfigurationParser.java +++ b/java/org/apache/tomcat/util/net/openssl/ciphers/OpenSSLCipherConfigurationParser.java @@ -860,11 +860,11 @@ public class OpenSSLCipherConfigurationParser { for(argindex = 0; argindex < args.length; ++argindex) { String arg = args[argindex]; - if("--verbose".equals(arg) || "-v".equals(arg)) + if("--verbose".equals(arg) || "-v".equals(arg)) { verbose = true; - else if("--openssl".equals(arg)) + } else if("--openssl".equals(arg)) { useOpenSSLNames = true; - else if("--help".equals(arg) || "-h".equals(arg)) { + } else if("--help".equals(arg) || "-h".equals(arg)) { usage(); System.exit(0); } @@ -895,13 +895,15 @@ public class OpenSSLCipherConfigurationParser { if(first) { first = false; } else { - if(!verbose) + if(!verbose) { System.out.print(','); + } } - if(useOpenSSLNames) + if(useOpenSSLNames) { System.out.print(cipher.getOpenSSLAlias()); - else + } else { System.out.print(cipher.name()); + } if(verbose) { System.out.println("\t" + cipher.getProtocol() + "\tKx=" + cipher.getKx() + "\tAu=" + cipher.getAu() + "\tEnc=" + cipher.getEnc() + "\tMac=" + cipher.getMac()); } diff --git a/res/checkstyle/checkstyle.xml b/res/checkstyle/checkstyle.xml index b2bb0eb..87b40b4 100644 --- a/res/checkstyle/checkstyle.xml +++ b/res/checkstyle/checkstyle.xml @@ -53,7 +53,7 @@ <module name="AvoidNestedBlocks"> <property name="allowInSwitchCase" value="true"/> </module> - <!-- ~650 errors + <!-- ~400 errors <module name="NeedBraces"/> --> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org