From e8ac7e94e28b1ad6c01ab6588a4120f6ad3f1ff4 Mon Sep 17 00:00:00 2001
From: lan <1728209643@qq.com>
Date: Sun, 17 Jan 2021 20:20:43 +0000
Subject: [PATCH] ZOOKEEPER-4058: Update checkstyle to the latest version 8.39
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
1.update checkstyle to latest version 8.39
See [https://checkstyle.sourceforge.io/config_javadoc.html](https://checkstyle.sourceforge.io/config_javadoc.html)
- JavadocMethod: remove properties `allowMissingJavadoc,allowMissingThrowsTags,allowThrowsTagsForSubclasses,allowUndeclaredRTE`
- LineLength: change it's parent to Checker
2.update XML dtd: `checkstyle-strict.xml, checkstyle-simple.xml, checkstyleSuppressions.xml`
3.fix code style:
- `QuorumPeer.java, PemReader.java`. Operators like + and ? appear at newlines rather than at the end of the previous line.
- license of `TestApacheCuratorCompatibility.java`. Checkstyle JavadocParagraph:`
` tag should be placed immediately before the first word.
Author: lan <1728209643@qq.com>
Reviewers: Enrico Olivelli , Damien Diederen
Closes #1579 from lanicc/ZOOKEEPER-4058
---
checkstyle-simple.xml | 4 +-
checkstyle-strict.xml | 56 +++++++++----------
checkstyleSuppressions.xml | 5 +-
pom.xml | 4 +-
.../TestApacheCuratorCompatibility.java | 8 +--
.../zookeeper/server/quorum/QuorumPeer.java | 4 +-
.../org/apache/zookeeper/util/PemReader.java | 18 +++---
7 files changed, 47 insertions(+), 52 deletions(-)
diff --git a/checkstyle-simple.xml b/checkstyle-simple.xml
index 204937026a8..004cd68e417 100644
--- a/checkstyle-simple.xml
+++ b/checkstyle-simple.xml
@@ -16,8 +16,8 @@
limitations under the License.
-->
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+page at https://checkstyle.sourceforge.io/config.html -->
@@ -140,16 +140,12 @@ page at http://checkstyle.sourceforge.net/config.html -->
-->
-
+
-
-
-
-
@@ -271,27 +267,6 @@ page at http://checkstyle.sourceforge.net/config.html -->
-
-
-
-
-
-
-
-
-
-
-
-
@@ -433,4 +408,25 @@ page at http://checkstyle.sourceforge.net/config.html -->
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/checkstyleSuppressions.xml b/checkstyleSuppressions.xml
index 0a270041419..eb23d475f86 100644
--- a/checkstyleSuppressions.xml
+++ b/checkstyleSuppressions.xml
@@ -13,9 +13,8 @@
limitations under the License. See accompanying LICENSE file.
-->
-
+ "-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
+ "https://checkstyle.org/dtds/suppressions_1_0.dtd">
diff --git a/pom.xml b/pom.xml
index 5d5080b7315..758852b8206 100755
--- a/pom.xml
+++ b/pom.xml
@@ -447,7 +447,7 @@
4.4
4.1.12.1
4.0.2
- 8.17
+ 8.39
3.0.0-M3
@@ -760,7 +760,7 @@
org.apache.maven.plugins
maven-checkstyle-plugin
- 3.1.0
+ 3.1.1
com.puppycrawl.tools
diff --git a/zookeeper-compatibility-tests/zookeeper-compatibility-tests-curator/src/test/java/org/apache/zookeeper/compatibility/TestApacheCuratorCompatibility.java b/zookeeper-compatibility-tests/zookeeper-compatibility-tests-curator/src/test/java/org/apache/zookeeper/compatibility/TestApacheCuratorCompatibility.java
index fbb387601bd..d8111281b8f 100644
--- a/zookeeper-compatibility-tests/zookeeper-compatibility-tests-curator/src/test/java/org/apache/zookeeper/compatibility/TestApacheCuratorCompatibility.java
+++ b/zookeeper-compatibility-tests/zookeeper-compatibility-tests-curator/src/test/java/org/apache/zookeeper/compatibility/TestApacheCuratorCompatibility.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
index 44c83a6c842..3102c6379ed 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
@@ -507,8 +507,8 @@ private List excludedSpecialAddresses(List
}
InetAddress inetaddr = addr.getAddress();
- if (inetaddr == null || inetaddr.isAnyLocalAddress() || // wildCard addresses (0.0.0.0 or [::])
- inetaddr.isLoopbackAddress()) { // loopback address(localhost/127.0.0.1)
+ if (inetaddr == null || inetaddr.isAnyLocalAddress() // wildCard addresses (0.0.0.0 or [::])
+ || inetaddr.isLoopbackAddress()) { // loopback address(localhost/127.0.0.1)
continue;
}
included.add(addr);
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java b/zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java
index 9ab2241864b..dd5a1576401 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/util/PemReader.java
@@ -67,21 +67,21 @@
public final class PemReader {
private static final Pattern CERT_PATTERN = Pattern.compile(
- "-+BEGIN\\s+.*CERTIFICATE[^-]*-+(?:\\s|\\r|\\n)+" + // Header
- "([a-z0-9+/=\\r\\n]+)" + // Base64 text
- "-+END\\s+.*CERTIFICATE[^-]*-+", // Footer
+ "-+BEGIN\\s+.*CERTIFICATE[^-]*-+(?:\\s|\\r|\\n)+" // Header
+ + "([a-z0-9+/=\\r\\n]+)" // Base64 text
+ + "-+END\\s+.*CERTIFICATE[^-]*-+", // Footer
CASE_INSENSITIVE);
private static final Pattern PRIVATE_KEY_PATTERN = Pattern.compile(
- "-+BEGIN\\s+.*PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+" + // Header
- "([a-z0-9+/=\\r\\n]+)" + // Base64 text
- "-+END\\s+.*PRIVATE\\s+KEY[^-]*-+", // Footer
+ "-+BEGIN\\s+.*PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+" // Header
+ + "([a-z0-9+/=\\r\\n]+)" // Base64 text
+ + "-+END\\s+.*PRIVATE\\s+KEY[^-]*-+", // Footer
CASE_INSENSITIVE);
private static final Pattern PUBLIC_KEY_PATTERN = Pattern.compile(
- "-+BEGIN\\s+.*PUBLIC\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+" + // Header
- "([a-z0-9+/=\\r\\n]+)" + // Base64 text
- "-+END\\s+.*PUBLIC\\s+KEY[^-]*-+", // Footer
+ "-+BEGIN\\s+.*PUBLIC\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+" // Header
+ + "([a-z0-9+/=\\r\\n]+)" // Base64 text
+ + "-+END\\s+.*PUBLIC\\s+KEY[^-]*-+", // Footer
CASE_INSENSITIVE);
private PemReader() {