[SCB-2583] enable checkstyle trailing whitespace (#3097)

diff --git a/ci/checkstyle/checkstyle.xml b/ci/checkstyle/checkstyle.xml
index 9684dc3..5beaa31 100644
--- a/ci/checkstyle/checkstyle.xml
+++ b/ci/checkstyle/checkstyle.xml
@@ -31,6 +31,11 @@
   </module>
   <module name="NewlineAtEndOfFile">
   </module>
+  <module name="RegexpSingleline">
+    <property name="format" value="\s+$"/>
+    <property name="message" value="Trailing whitespace"/>
+    <property name="severity" value="error"/>
+  </module>
   <module name="TreeWalker">
     <module name="AvoidStarImport"/>
     <module name="EmptyStatement"/>
diff --git a/common/common-access-log/src/main/java/org/apache/servicecomb/common/accessLog/core/parser/CompositeVertxRestAccessLogItemMeta.java b/common/common-access-log/src/main/java/org/apache/servicecomb/common/accessLog/core/parser/CompositeVertxRestAccessLogItemMeta.java
index f360847..6e4c477 100644
--- a/common/common-access-log/src/main/java/org/apache/servicecomb/common/accessLog/core/parser/CompositeVertxRestAccessLogItemMeta.java
+++ b/common/common-access-log/src/main/java/org/apache/servicecomb/common/accessLog/core/parser/CompositeVertxRestAccessLogItemMeta.java
@@ -22,7 +22,7 @@
 /**
  * Hold a group of {@link VertxRestAccessLogItemMeta} so that user can define
  * only one VertxRestAccessLogItemMeta in spi loading file and load a group of meta.
- * 
+ *
  * Once the access log loading mechanism finds that a meta is CompositeVertxRestAccessLogItemMeta,
  * the meta hold by it will be used in access log while this meta itself will be ignored.
  */
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SerializableParameterAdapter.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SerializableParameterAdapter.java
index 66ba8bd..fe2b8b8 100644
--- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SerializableParameterAdapter.java
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SerializableParameterAdapter.java
@@ -38,7 +38,7 @@
     if ("array".equals(parameter.getType())) {
       return parameter.getItems();
     }
-    
+
     return null;
   }
 
diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index 9ed9daa..10c443b 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -631,7 +631,7 @@
         engine.setStatus(SCBStatus.UP);
         engine.triggerEvent(EventType.AFTER_REGISTRY);
         EventManager.unregister(this);
-        // keep this message to be WARN, used to detect service ready. 
+        // keep this message to be WARN, used to detect service ready.
         LOGGER.warn("ServiceComb is ready.");
       }
     }
diff --git a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeAddHeaderClientFilter.java b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeAddHeaderClientFilter.java
index 95b67dd..c315393 100644
--- a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeAddHeaderClientFilter.java
+++ b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeAddHeaderClientFilter.java
@@ -85,7 +85,7 @@
     if (!invocation.isEdge()) {
       return;
     }
-    
+
     HttpServletRequestEx oldRequest = invocation.getRequestEx();
     publicHeaders.forEach(key -> {
       String value = oldRequest.getHeader(key);
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
index 4102b65..25bf4cb 100644
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
+++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/MimeTypesUtils.java
@@ -54,20 +54,20 @@
   }
 
   public static List<String> getSortedAcceptableMimeTypes(String acceptHeader) {
-    // accept anything when accept is not present       
+    // accept anything when accept is not present
     if (acceptHeader == null) {
       return Collections.emptyList();
     }
 
-    // parse      
+    // parse
     String[] items = COMMA_SPLITTER.split(acceptHeader);
-    // sort on quality        
+    // sort on quality
     Arrays.sort(items, ACCEPT_X_COMPARATOR);
 
     List<String> list = new ArrayList<>(items.length);
 
     for (String item : items) {
-      // find any ; e.g.: "application/json;q=0.8"        
+      // find any ; e.g.: "application/json;q=0.8"
       int space = item.indexOf(';');
 
       if (space != -1) {
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/RSAUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/RSAUtils.java
index 5923f9b..2274270 100644
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/RSAUtils.java
+++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/RSAUtils.java
@@ -74,7 +74,7 @@
   }
 
   /**
-   * if has performance problem ,change Signature to ThreadLocal instance 
+   * if has performance problem ,change Signature to ThreadLocal instance
    */
   public static String sign(String content, PrivateKey privateKey)
       throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {
@@ -87,10 +87,10 @@
 
   /**
    *
-   * if has performance problem ,change Signature to ThreadLocal instance  
-   * @param publicKey public key after base64 encode 
+   * if has performance problem ,change Signature to ThreadLocal instance
+   * @param publicKey public key after base64 encode
    * @param sign 签名
-   * @param content original content 
+   * @param content original content
    * @return verify result
    * @throws NoSuchAlgorithmException
    * @throws InvalidKeySpecException
diff --git a/foundations/foundation-common/src/test/resources/config/log4j.common.test.properties b/foundations/foundation-common/src/test/resources/config/log4j.common.test.properties
index 0f636e4..1249e38 100644
--- a/foundations/foundation-common/src/test/resources/config/log4j.common.test.properties
+++ b/foundations/foundation-common/src/test/resources/config/log4j.common.test.properties
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-# Override the log setting 
+# Override the log setting
 paas.logs.dir=./target/logs
 paas.logs.file=cse.log
 
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
index 3af93c8..3d03267 100644
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
+++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
@@ -192,7 +192,7 @@
         return true;
       }
     }
-    
+
     return false;
   }
 }
diff --git a/foundations/foundation-protobuf/src/main/java/io/protostuff/ByteArrayInputEx.java b/foundations/foundation-protobuf/src/main/java/io/protostuff/ByteArrayInputEx.java
index 98a1211..f496a70 100644
--- a/foundations/foundation-protobuf/src/main/java/io/protostuff/ByteArrayInputEx.java
+++ b/foundations/foundation-protobuf/src/main/java/io/protostuff/ByteArrayInputEx.java
@@ -3,7 +3,7 @@
 //------------------------------------------------------------------------
 //Licensed 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 
+//You may obtain a copy of the License at
 //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,
diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceFactory.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceFactory.java
index e4bc812..16b7147 100644
--- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceFactory.java
+++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceFactory.java
@@ -86,7 +86,7 @@
 
     microservice.setFramework(createFramework());
     microservice.setRegisterBy(CONFIG_DEFAULT_REGISTER_BY);
-    
+
     return microservice;
   }
 
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
index 09059de..54a917f 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
@@ -45,7 +45,7 @@
  * 1.getContentType<br>
  * 2.getSubmittedFileName<br>
  * extend from AbstractPart just because want to make it be Part type,
- * so that can be sent by 
+ * so that can be sent by
  * {@link org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse#sendPart(Part) VertxServerResponseToHttpServletResponse.sendPart}
  */
 public class ReadStreamPart extends AbstractPart {
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerResponseToHttpServletResponse.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerResponseToHttpServletResponse.java
index 52a2c88..668ce00 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerResponseToHttpServletResponse.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerResponseToHttpServletResponse.java
@@ -62,7 +62,7 @@
   public void setStatus(int sc) {
     serverResponse.setStatusCode(sc);
   }
-  
+
   @Override
   public StatusType getStatusType() {
     if (statusType == null) {
diff --git a/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/consumer/RSAConsumerTokenManager.java b/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/consumer/RSAConsumerTokenManager.java
index 4906d5e..7304ec3 100644
--- a/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/consumer/RSAConsumerTokenManager.java
+++ b/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/consumer/RSAConsumerTokenManager.java
@@ -71,7 +71,7 @@
 
   /**
    * the TTL of Token is  24 hours
-   * client token will expired 15 minutes early 
+   * client token will expired 15 minutes early
    */
   public boolean isExpired(RSAAuthenticationToken token) {
     if (null == token) {
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestVertxTransportConfig.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestVertxTransportConfig.java
index 0e4fa40..38cd8c0 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestVertxTransportConfig.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestRestVertxTransportConfig.java
@@ -86,7 +86,7 @@
       consumers.getIntf().testClientReceiveHeaderSize(100001 - RESPONSE_HEADER.length());
       Assertions.fail("an exception is expected!");
     } catch (InvocationException e) {
-      // in slow environment, may cause connection close. 
+      // in slow environment, may cause connection close.
       MatcherAssert.assertThat(ExceptionUtils.getExceptionMessageWithoutTrace(e),
           CoreMatchers.anyOf(CoreMatchers.containsString("HTTP header is larger than 10000 bytes"),
               CoreMatchers.containsString("Connection was closed")));
diff --git a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/AbstractInvocationMeters.java b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/AbstractInvocationMeters.java
index a825609..9491120 100644
--- a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/AbstractInvocationMeters.java
+++ b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/AbstractInvocationMeters.java
@@ -33,7 +33,7 @@
 
   private final Map<String, AbstractInvocationMeter> metersMap = new ConcurrentHashMapEx<>();
 
-  // not care for concurrency, just for make build key faster 
+  // not care for concurrency, just for make build key faster
   private int maxKeyLen = 64;
 
   public AbstractInvocationMeters(Registry registry) {
diff --git a/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseUriTemplateHandler.java b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseUriTemplateHandler.java
index ea5a858..ecc5ff7 100644
--- a/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseUriTemplateHandler.java
+++ b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseUriTemplateHandler.java
@@ -134,7 +134,7 @@
       throw new IllegalArgumentException("[" + uri + "] is not a valid URI");
     }
   }
-  
+
   private URI createUri(String uriTemplate, UriComponents uriComponents) {
     String strUri = uriComponents.toUriString();
 
diff --git a/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/TestRegistry.java b/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/TestRegistry.java
index 9f0d4f6..9a93381 100644
--- a/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/TestRegistry.java
+++ b/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/TestRegistry.java
@@ -114,7 +114,7 @@
     Assertions.assertEquals(properties, RegistryUtils.getMicroserviceInstance().getProperties());
 
     Assertions.assertEquals(microservice, RegistryUtils.getMicroservice(microservice.getServiceId()));
-    
+
     RegistryUtils.updateMicroserviceProperties(properties);
     Assertions.assertEquals(properties, RegistryUtils.getMicroservice().getProperties());
 
diff --git a/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestSimpleMicroserviceInstancePing.java b/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestSimpleMicroserviceInstancePing.java
index 086c658..04ff785 100644
--- a/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestSimpleMicroserviceInstancePing.java
+++ b/service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/consumer/TestSimpleMicroserviceInstancePing.java
@@ -44,7 +44,7 @@
     ss.close();
     Assertions.assertFalse(ping.ping(instance));
   }
-  
+
   @Test
   public void testPing_more_endpoin() throws IOException {
     SimpleMicroserviceInstancePing ping = new SimpleMicroserviceInstancePing();
@@ -58,5 +58,5 @@
     ss.close();
     Assertions.assertFalse(ping.ping(instance));
   }
-    
+
 }
diff --git a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/AbstractZeroConfigRegistration.java b/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/AbstractZeroConfigRegistration.java
index 39f0c00..b69d98a 100644
--- a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/AbstractZeroConfigRegistration.java
+++ b/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/AbstractZeroConfigRegistration.java
@@ -44,7 +44,7 @@
   @Override

   public void run() {

     super.run();

-    

+

     postRegisteredEvent();

     startRegister(config.getHeartbeatInterval());

   }