You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/10/26 18:21:24 UTC

[solr] 05/09: SOLR-16427: Evaluate and fix errorprone rules - EscapedEntity / UnescapedEntity

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit daa4bdc5ffb09074a8b4fbbede3c5c11e28bf756
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Mon Oct 24 15:17:34 2022 -0400

    SOLR-16427: Evaluate and fix errorprone rules - EscapedEntity / UnescapedEntity
---
 gradle/validation/error-prone.gradle               |  2 --
 .../cloud/ZkDistributedCollectionLockFactory.java  | 26 +++++++++++-----------
 .../cloud/ZkDistributedConfigSetLockFactory.java   | 12 +++++-----
 .../java/org/apache/solr/handler/GraphHandler.java | 11 ++++-----
 .../org/apache/solr/handler/StreamHandler.java     |  3 +--
 .../src/java/org/apache/solr/util/hll/HLLUtil.java | 10 ++++-----
 .../apache/solr/util/hll/SerializationUtil.java    |  4 ++--
 .../client/solrj/beans/DocumentObjectBinder.java   |  6 ++---
 8 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index 276bb435449..fa61cabb918 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -84,7 +84,6 @@ allprojects { prj ->
             '-Xep:DoubleCheckedLocking:OFF',
             '-Xep:EmptyCatch:OFF',
             '-Xep:EqualsUnsafeCast:OFF',
-            '-Xep:EscapedEntity:OFF',
             '-Xep:Finally:OFF',
             '-Xep:FutureReturnValueIgnored:OFF',
             '-Xep:IdentityBinaryExpression:OFF',
@@ -121,7 +120,6 @@ allprojects { prj ->
             '-Xep:ThreadPriorityCheck:OFF',
             '-Xep:TypeParameterShadowing:OFF',
             '-Xep:TypeParameterUnusedInFormals:OFF',
-            '-Xep:UnescapedEntity:OFF',
             '-Xep:UnicodeEscape:OFF',
             '-Xep:UnnecessaryParentheses:OFF',
             '-Xep:UnusedMethod:OFF',
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedCollectionLockFactory.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedCollectionLockFactory.java
index 56f8c61c188..9d787289c87 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedCollectionLockFactory.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedCollectionLockFactory.java
@@ -63,19 +63,19 @@ public class ZkDistributedCollectionLockFactory extends ZkDistributedLockFactory
    *
    * <p>The tree of lock directories for a given collection {@code collName} is as follows:
    *
-   * <pre>
-   *   rootPath/
-   *      collName/
-   *         Locks   <-- EPHEMERAL collection level locks go here
-   *         _ShardName1/
-   *            Locks   <-- EPHEMERAL shard level locks go here
-   *            _replicaNameS1R1   <-- EPHEMERAL replica level locks go here
-   *            _replicaNameS1R2   <-- EPHEMERAL replica level locks go here
-   *         _ShardName2/
-   *            Locks   <-- EPHEMERAL shard level locks go here
-   *            _replicaNameS2R1   <-- EPHEMERAL replica level locks go here
-   *            _replicaNameS2R2   <-- EPHEMERAL replica level locks go here
-   * </pre>
+   * <pre>{@code
+   * rootPath/
+   *    collName/
+   *       Locks   <-- EPHEMERAL collection level locks go here
+   *       _ShardName1/
+   *          Locks   <-- EPHEMERAL shard level locks go here
+   *          _replicaNameS1R1   <-- EPHEMERAL replica level locks go here
+   *          _replicaNameS1R2   <-- EPHEMERAL replica level locks go here
+   *       _ShardName2/
+   *          Locks   <-- EPHEMERAL shard level locks go here
+   *          _replicaNameS2R1   <-- EPHEMERAL replica level locks go here
+   *          _replicaNameS2R2   <-- EPHEMERAL replica level locks go here
+   * }</pre>
    *
    * This method will create the path where the {@code EPHEMERAL} lock nodes should go. That path
    * is:
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedConfigSetLockFactory.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedConfigSetLockFactory.java
index 4ea61f63f77..488c69932a0 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedConfigSetLockFactory.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedConfigSetLockFactory.java
@@ -50,12 +50,12 @@ public class ZkDistributedConfigSetLockFactory extends ZkDistributedLockFactory
    * <p>The tree of lock directories is very flat, given there's no real structure to what's being
    * locked in a config set:
    *
-   * <pre>
-   *   rootPath/
-   *      configSet1/ <-- EPHEMERAL config set locks go here
-   *      configSet2/ <-- EPHEMERAL config set locks go here
-   *      etc...
-   * </pre>
+   * <pre>{@code
+   * rootPath/
+   *    configSet1/ <-- EPHEMERAL config set locks go here
+   *    configSet2/ <-- EPHEMERAL config set locks go here
+   *    etc...
+   * }</pre>
    *
    * This method will create the path where the {@code EPHEMERAL} lock nodes should go.
    *
diff --git a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
index dafa0863de6..b5a8dfc7a05 100644
--- a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
@@ -60,14 +60,11 @@ import org.slf4j.LoggerFactory;
  * org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory}.
  *
  * <p>To add additional functions, just define them as plugins in solrconfig.xml via {@code
- * &lt;expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream"
- * /&gt; }
+ * <expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream" />}
  *
- * <p>The @deprecated configuration method as of Solr 8.5 is {@code &lt;lst
- * name="streamFunctions"&gt; &lt;str
- * name="group"&gt;org.apache.solr.client.solrj.io.stream.ReducerStream&lt;/str&gt; &lt;str
- * name="count"&gt;org.apache.solr.client.solrj.io.stream.RecordCountStream&lt;/str&gt; &lt;/lst&gt;
- * }
+ * <p>The @deprecated configuration method as of Solr 8.5 is {@code <lst name="streamFunctions"><str
+ * name="group">org.apache.solr.client.solrj.io.stream.ReducerStream</str><str
+ * name="count">org.apache.solr.client.solrj.io.stream.RecordCountStream</str></lst> }
  *
  * @since 6.1.0
  */
diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
index 984ca83411a..c0e279c5a29 100644
--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
@@ -76,8 +76,7 @@ import org.slf4j.LoggerFactory;
  * org.apache.solr.handler.SolrDefaultStreamFactory}.
  *
  * <p>To add additional functions, just define them as plugins in solrconfig.xml via {@code
- * &lt;expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream"
- * /&gt; }
+ * <expressible name="count" class="org.apache.solr.client.solrj.io.stream.RecordCountStream" />}
  *
  * @since 5.1.0
  */
diff --git a/solr/core/src/java/org/apache/solr/util/hll/HLLUtil.java b/solr/core/src/java/org/apache/solr/util/hll/HLLUtil.java
index 9a5eb5082d4..3d955f2edc6 100644
--- a/solr/core/src/java/org/apache/solr/util/hll/HLLUtil.java
+++ b/solr/core/src/java/org/apache/solr/util/hll/HLLUtil.java
@@ -22,11 +22,11 @@ final class HLLUtil {
    * Precomputed <code>pwMaxMask</code> values indexed by <code>registerSizeInBits</code>.
    * Calculated with this formula:
    *
-   * <pre>
-   *     int maxRegisterValue = (1 << registerSizeInBits) - 1;
-   *     // Mask with all bits set except for (maxRegisterValue - 1) least significant bits (see #addRaw())
-   *     return ~((1L << (maxRegisterValue - 1)) - 1);
-   * </pre>
+   * <pre>{@code
+   * int maxRegisterValue = (1 << registerSizeInBits) - 1;
+   * // Mask with all bits set except for (maxRegisterValue - 1) least significant bits (see #addRaw())
+   * return ~((1L << (maxRegisterValue - 1)) - 1);
+   * }</pre>
    *
    * @see #pwMaxMask(int)
    */
diff --git a/solr/core/src/java/org/apache/solr/util/hll/SerializationUtil.java b/solr/core/src/java/org/apache/solr/util/hll/SerializationUtil.java
index f15962d50ae..7548c680d34 100644
--- a/solr/core/src/java/org/apache/solr/util/hll/SerializationUtil.java
+++ b/solr/core/src/java/org/apache/solr/util/hll/SerializationUtil.java
@@ -137,8 +137,8 @@ class SerializationUtil {
    *     <ul>
    *       <li>If 'explicit-disabled' is chosen, this value should be <code>0</code>.
    *       <li>If 'auto' is chosen, this value should be <code>63</code>.
-   *       <li>If a cutoff of 2<sup>n</sup> is desired, for <code>0 <= n < 31</code>, this value
-   *           should be <code>n + 1</code>.
+   *       <li>If a cutoff of 2<sup>n</sup> is desired, for {@code 0 <= n < 31}, this value should
+   *           be {@code n + 1}.
    *     </ul>
    *
    * @param sparseEnabled whether {@link HLLType#SPARSE} should be used in the promotion hierarchy
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
index 8f6a2058e6a..d0f65eeb354 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
@@ -353,9 +353,9 @@ public class DocumentObjectBinder {
 
     /**
      * Called by the {@link #inject} method to read the value(s) for a field This method supports
-     * reading of all "matching" fieldName's in the <code>SolrDocument</code> Returns <code>
-     * SolrDocument.getFieldValue</code> for regular fields, and <code>Map<String, List<Object>>
-     * </code> for a dynamic field. The key is all matching fieldName's.
+     * reading of all "matching" fieldName's in the {@link SolrDocument} Returns {@link
+     * SolrDocument#getFieldValue} for regular fields, and {@code Map<String, List<Object>>} for a
+     * dynamic field. The key is all matching fieldName's.
      */
     private Object getFieldValue(SolrDocument solrDocument) {
       if (child != null) {