You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2024/03/18 14:24:34 UTC

(pulsar) branch branch-3.1 updated: [improve][misc] Upgrade checkstyle to 10.14.2 (#22291)

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

lhotari pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 31c5206619f [improve][misc] Upgrade checkstyle to 10.14.2 (#22291)
31c5206619f is described below

commit 31c5206619f7b9235f6a225ed82152b74b8bc1a3
Author: Zixuan Liu <no...@gmail.com>
AuthorDate: Mon Mar 18 21:37:03 2024 +0800

    [improve][misc] Upgrade checkstyle to 10.14.2 (#22291)
    
    (cherry picked from commit cd512e4da6a04c68d448a452c76b10b49014033d)
---
 buildtools/pom.xml                                       |  2 +-
 buildtools/src/main/resources/pulsar/checkstyle.xml      |  2 +-
 pom.xml                                                  |  2 +-
 .../broker/service/persistent/PersistentTopic.java       |  4 ++--
 .../java/org/apache/pulsar/client/impl/ProducerImpl.java |  6 +++---
 .../org/apache/pulsar/common/tls/InetAddressUtils.java   | 16 +++++++++-------
 .../pulsar/common/util/collections/LongPairSet.java      |  4 ++--
 7 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/buildtools/pom.xml b/buildtools/pom.xml
index b82d40b181f..221a006a8ec 100644
--- a/buildtools/pom.xml
+++ b/buildtools/pom.xml
@@ -45,7 +45,7 @@
     <testng.version>7.7.1</testng.version>
     <commons-lang3.version>3.11</commons-lang3.version>
     <license-maven-plugin.version>4.1</license-maven-plugin.version>
-    <puppycrawl.checkstyle.version>8.37</puppycrawl.checkstyle.version>
+    <puppycrawl.checkstyle.version>10.14.2</puppycrawl.checkstyle.version>
     <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
     <netty.version>4.1.100.Final</netty.version>
     <guice.version>4.2.3</guice.version>
diff --git a/buildtools/src/main/resources/pulsar/checkstyle.xml b/buildtools/src/main/resources/pulsar/checkstyle.xml
index c63c8993408..14808cf8663 100644
--- a/buildtools/src/main/resources/pulsar/checkstyle.xml
+++ b/buildtools/src/main/resources/pulsar/checkstyle.xml
@@ -179,7 +179,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
         <module name="JavadocMethod">
-            <property name="scope" value="protected"/>
+            <property name="accessModifiers" value="protected"/>
             <property name="severity" value="error"/>
             <property name="allowMissingParamTags" value="true"/>
             <property name="allowMissingReturnTag" value="true"/>
diff --git a/pom.xml b/pom.xml
index a6c40e8b364..cbac6bc3cee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -158,7 +158,7 @@ flexible messaging model and an intuitive client API.</description>
     <jackson.version>2.14.2</jackson.version>
     <reflections.version>0.10.2</reflections.version>
     <swagger.version>1.6.2</swagger.version>
-    <puppycrawl.checkstyle.version>8.37</puppycrawl.checkstyle.version>
+    <puppycrawl.checkstyle.version>10.14.2</puppycrawl.checkstyle.version>
     <docker-maven.version>0.43.3</docker-maven.version>
     <docker.verbose>true</docker.verbose>
     <typetools.version>0.5.0</typetools.version>
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
index b434d8a2dbc..5bceed099c1 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
@@ -888,8 +888,8 @@ public class PersistentTopic extends AbstractTopic implements Topic, AddEntryCal
                 lock.readLock().unlock();
             }
 
-            CompletableFuture<? extends Subscription> subscriptionFuture = isDurable ? //
-                    getDurableSubscription(subscriptionName, initialPosition, startMessageRollbackDurationSec,
+            CompletableFuture<? extends Subscription> subscriptionFuture = isDurable
+                    ? getDurableSubscription(subscriptionName, initialPosition, startMessageRollbackDurationSec,
                             replicatedSubscriptionState, subscriptionProperties)
                     : getNonDurableSubscription(subscriptionName, startMessageId, initialPosition,
                     startMessageRollbackDurationSec, readCompacted, subscriptionProperties);
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
index 8d2d917d7b8..3fc3bbf3cf7 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
@@ -1831,9 +1831,9 @@ public class ProducerImpl<T> extends ProducerBase<T> implements TimerTask, Conne
                         producerCreatedFuture.completeExceptionally(cause);
                         closeProducerTasks();
                         client.cleanupProducer(this);
-                    } else if (producerCreatedFuture.isDone() || //
-                               (cause instanceof PulsarClientException && PulsarClientException.isRetriableError(cause)
-                                && System.currentTimeMillis() < PRODUCER_DEADLINE_UPDATER.get(ProducerImpl.this))) {
+                    } else if (producerCreatedFuture.isDone()
+                            || (cause instanceof PulsarClientException && PulsarClientException.isRetriableError(cause)
+                            && System.currentTimeMillis() < PRODUCER_DEADLINE_UPDATER.get(ProducerImpl.this))) {
                         // Either we had already created the producer once (producerCreatedFuture.isDone()) or we are
                         // still within the initial timeout budget and we are dealing with a retriable error
                         future.completeExceptionally(cause);
diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/tls/InetAddressUtils.java b/pulsar-common/src/main/java/org/apache/pulsar/common/tls/InetAddressUtils.java
index a8bf837ef56..d0f3c81a074 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/tls/InetAddressUtils.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/tls/InetAddressUtils.java
@@ -35,9 +35,12 @@ public class InetAddressUtils {
     }
 
     private static final String IPV4_BASIC_PATTERN_STRING =
-            "(([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){1}" + // initial first field, 1-255
-            "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){2}" + // following 2 fields, 0-255 followed by .
-             "([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])"; // final field, 0-255
+            // initial first field, 1-255
+            "(([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){1}"
+                    // following 2 fields, 0-255 followed by .
+                    + "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){2}"
+                    // final field, 0-255
+                    + "([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])";
 
     private static final Pattern IPV4_PATTERN =
         Pattern.compile("^" + IPV4_BASIC_PATTERN_STRING + "$");
@@ -50,10 +53,9 @@ public class InetAddressUtils {
                 "^[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){7}$");
 
     private static final Pattern IPV6_HEX_COMPRESSED_PATTERN =
-        Pattern.compile(
-                "^(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)" + // 0-6 hex fields
-                 "::" + // concat
-                 "(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)$"); // 0-6 hex fields
+            Pattern.compile("^(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)" // 0-6 hex fields
+                    + "::"  // concat
+                    + "(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)$"); // 0-6 hex fields
 
     /*
      *  The above pattern is not totally rigorous as it allows for more than 7 hex fields in total
diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/LongPairSet.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/LongPairSet.java
index 3750d8c2202..e699d01b9c2 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/LongPairSet.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/LongPairSet.java
@@ -96,7 +96,7 @@ public interface LongPairSet {
     /**
      * Predicate to checks for a key-value pair where both of them have long types.
      */
-    public interface LongPairPredicate {
+    interface LongPairPredicate {
         boolean test(long v1, long v2);
     }
 
@@ -132,7 +132,7 @@ public interface LongPairSet {
      *
      */
     @FunctionalInterface
-    public interface LongPairFunction<T> {
+    interface LongPairFunction<T> {
 
         /**
          * Applies this function to the given arguments.