ChristopherSchultz commented on code in PR #834:
URL: https://github.com/apache/tomcat/pull/834#discussion_r2018982394
##########
java/org/apache/jasper/compiler/Parser.java:
##########
@@ -1471,8 +1471,8 @@ private void parseBody(Node parent, String tag, String
bodyType) throws JasperEx
err.jspError(start, "jasper.error.emptybodycontent.nonempty",
tag);
}
} else if (bodyType.equalsIgnoreCase(TagInfo.BODY_CONTENT_JSP) ||
- bodyType.equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS) ||
(bodyType == JAVAX_BODY_CONTENT_PARAM) ||
- (bodyType == JAVAX_BODY_CONTENT_TEMPLATE_TEXT)) {
+ bodyType.equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS) ||
(bodyType.equals(JAVAX_BODY_CONTENT_PARAM)) ||
+ (bodyType.equals(JAVAX_BODY_CONTENT_TEMPLATE_TEXT))) {
Review Comment:
The only time this will be true is when this particular constant is being
used, internally. Using .equals is needless pedantry.
##########
java/org/apache/tomcat/util/digester/Digester.java:
##########
@@ -2037,7 +2038,7 @@ private StringBuilder updateBodyText(StringBuilder
bodyText) {
return bodyText; // return unchanged data
}
- if (out == in) {
+ if (Objects.equals(out, in)) {
Review Comment:
No. This is a performance de-optimization.
##########
java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java:
##########
@@ -503,7 +504,7 @@ public void init(KeyManager[] kms, TrustManager[] tms,
SecureRandom sr) throws K
}
}
// Check if the ciphers have been changed from the defaults
- if (maxTlsVersion >= TLS1_3_VERSION() &&
(sslHostConfig.getCiphers() != SSLHostConfig.DEFAULT_TLS_CIPHERS)) {
+ if (maxTlsVersion >= TLS1_3_VERSION() &&
(!Objects.equals(sslHostConfig.getCiphers(),
SSLHostConfig.DEFAULT_TLS_CIPHERS))) {
Review Comment:
This one is at least not-harmful but unnecessary. The default value of
Ciphers is DEFAULT_TLS_CIPHERS (exactly, as in "the exact same object
reference").
##########
java/org/apache/catalina/realm/DigestCredentialHandlerBase.java:
##########
@@ -288,7 +289,7 @@ protected String mutate(String inputCredentials, byte[]
salt, int iterations, in
* @return <code>true</code> if the strings are equal to each other,
<code>false</code> otherwise.
*/
public static boolean equals(final String s1, final String s2, final
boolean ignoreCase) {
- if (s1 == s2) {
+ if (Objects.equals(s1, s2)) {
Review Comment:
No. This is obviously a performance optimization and should not be replaced.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]