Repository: alibaba/fescar
Pull request #564 (2019-03-08 16:16:20)

Minor refine and fix
This PR contains some small refine and fixes:

(1) renaming `isEmpty` to `isNullOrEmpty`
(2) renaming `RejectedPolicys ` to `RejectedPolicies `
(3) refining some static final variables

CLAassistant: [![CLA assistant check](https://cla-assistant.io/pull/badge/not_signed)](https://cla-assistant.io/alibaba/fescar?pullRequest=564) <br/>Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our [Contributor License Agreement](https://cla-assistant.io/alibaba/fescar?pullRequest=564) before we can accept your contribution.<br/><hr/>**Jovan** seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/><sub>You have signed the CLA already but the status is still pending? Let us [recheck](https://cla-assistant.io/check/alibaba/fescar?pullRequest=564) it.</sub>
jovany-wang: Thanks @slievrly , The CLA signed and all conflicts were resolved.
codecov-io: # [Codecov](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=h1) Report
> Merging [#564](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=desc) into [develop](https://codecov.io/gh/alibaba/fescar/commit/7bbefd043ff8bc94f4be3546c702f3e4d726162b?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `8.33%`.

[![Impacted file tree graph](https://codecov.io/gh/alibaba/fescar/pull/564/graphs/tree.svg?width=650&token=Hy9a6MCc4p&height=150&src=pr)](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##             develop     #564   +/-   ##
==========================================
  Coverage      31.65%   31.65%           
  Complexity       765      765           
==========================================
  Files            200      200           
  Lines           7916     7916           
  Branches         937      937           
==========================================
  Hits            2506     2506           
  Misses          5153     5153           
  Partials         257      257
```


| [Impacted Files](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...va/com/alibaba/fescar/common/util/StringUtils.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL2NvbW1vbi91dGlsL1N0cmluZ1V0aWxzLmphdmE=) | `41.66% <ø> (ø)` | `6 <0> (ø)` | :arrow_down: |
| [...ar/spring/annotation/GlobalTransactionScanner.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-c3ByaW5nL3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL3NwcmluZy9hbm5vdGF0aW9uL0dsb2JhbFRyYW5zYWN0aW9uU2Nhbm5lci5qYXZh) | `42.85% <0%> (ø)` | `9 <0> (ø)` | :arrow_down: |
| [...alibaba/fescar/common/thread/RejectedPolicies.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL2NvbW1vbi90aHJlYWQvUmVqZWN0ZWRQb2xpY2llcy5qYXZh) | `50% <0%> (ø)` | `1 <0> (?)` | |
| [...ing/annotation/GlobalTransactionalInterceptor.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-c3ByaW5nL3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL3NwcmluZy9hbm5vdGF0aW9uL0dsb2JhbFRyYW5zYWN0aW9uYWxJbnRlcmNlcHRvci5qYXZh) | `12.72% <0%> (ø)` | `2 <0> (ø)` | :arrow_down: |
| [...ar/rm/datasource/exec/SelectForUpdateExecutor.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-cm0tZGF0YXNvdXJjZS9zcmMvbWFpbi9qYXZhL2NvbS9hbGliYWJhL2Zlc2Nhci9ybS9kYXRhc291cmNlL2V4ZWMvU2VsZWN0Rm9yVXBkYXRlRXhlY3V0b3IuamF2YQ==) | `0% <0%> (ø)` | `0 <0> (ø)` | :arrow_down: |
| [...aba/fescar/server/lock/DefaultLockManagerImpl.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-c2VydmVyL3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL3NlcnZlci9sb2NrL0RlZmF1bHRMb2NrTWFuYWdlckltcGwuamF2YQ==) | `84% <0%> (ø)` | `17 <0> (ø)` | :arrow_down: |
| [...escar/rm/datasource/sql/struct/TableMetaCache.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-cm0tZGF0YXNvdXJjZS9zcmMvbWFpbi9qYXZhL2NvbS9hbGliYWJhL2Zlc2Nhci9ybS9kYXRhc291cmNlL3NxbC9zdHJ1Y3QvVGFibGVNZXRhQ2FjaGUuamF2YQ==) | `50.34% <0%> (ø)` | `9 <0> (ø)` | :arrow_down: |
| [...ar/discovery/registry/FileRegistryServiceImpl.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-ZGlzY292ZXJ5L3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL2Rpc2NvdmVyeS9yZWdpc3RyeS9GaWxlUmVnaXN0cnlTZXJ2aWNlSW1wbC5qYXZh) | `64% <0%> (ø)` | `7 <0> (ø)` | :arrow_down: |
| [...va/com/alibaba/fescar/core/rpc/ChannelManager.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-Y29yZS9zcmMvbWFpbi9qYXZhL2NvbS9hbGliYWJhL2Zlc2Nhci9jb3JlL3JwYy9DaGFubmVsTWFuYWdlci5qYXZh) | `0% <0%> (ø)` | `0 <0> (ø)` | :arrow_down: |
| [...n/java/com/alibaba/fescar/common/util/NetUtil.java](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvY29tL2FsaWJhYmEvZmVzY2FyL2NvbW1vbi91dGlsL05ldFV0aWwuamF2YQ==) | `57.35% <0%> (ø)` | `14 <0> (ø)` | :arrow_down: |
| ... and [3 more](https://codecov.io/gh/alibaba/fescar/pull/564/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=footer). Last update [7bbefd0...0e4a1a2](https://codecov.io/gh/alibaba/fescar/pull/564?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

jovany-wang: Thanks @github-ygy and @slievrly , all comments were addressed!

Patch:
diff --git a/common/src/main/java/com/alibaba/fescar/common/thread/RejectedPolicys.java b/common/src/main/java/com/alibaba/fescar/common/thread/RejectedPolicies.java
similarity index 95%
rename from common/src/main/java/com/alibaba/fescar/common/thread/RejectedPolicys.java
rename to common/src/main/java/com/alibaba/fescar/common/thread/RejectedPolicies.java
index bfaaf6722..32f661642 100644
--- a/common/src/main/java/com/alibaba/fescar/common/thread/RejectedPolicys.java
+++ b/common/src/main/java/com/alibaba/fescar/common/thread/RejectedPolicies.java
@@ -21,11 +21,11 @@ import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ThreadPoolExecutor;
 
 /**
- * policys for RejectedExecutionHandler
+ * Policies for RejectedExecutionHandler
  *
  * Created by guoyao on 2019/2/26.
  */
-public final class RejectedPolicys {
+public final class RejectedPolicies {
 
     /**
      * when rejected happened ,add the new task and run the oldest task
diff --git a/common/src/main/java/com/alibaba/fescar/common/util/NetUtil.java b/common/src/main/java/com/alibaba/fescar/common/util/NetUtil.java
index cc0503326..fd710fd50 100644
--- a/common/src/main/java/com/alibaba/fescar/common/util/NetUtil.java
+++ b/common/src/main/java/com/alibaba/fescar/common/util/NetUtil.java
@@ -36,7 +36,7 @@ public class NetUtil {
     private static final Logger LOGGER = LoggerFactory.getLogger(NetUtil.class);
     private static final String LOCALHOST = "127.0.0.1";
 
-    private static final String ANYHOST = "0.0.0.0";
+    private static final String ANY_HOST = "0.0.0.0";
 
     private static volatile InetAddress LOCAL_ADDRESS = null;
 
@@ -202,6 +202,6 @@ public class NetUtil {
             return false;
         }
         String name = address.getHostAddress();
-        return (name != null && !ANYHOST.equals(name) && !LOCALHOST.equals(name) && IP_PATTERN.matcher(name).matches());
+        return (name != null && !ANY_HOST.equals(name) && !LOCALHOST.equals(name) && IP_PATTERN.matcher(name).matches());
     }
 }
diff --git a/common/src/main/java/com/alibaba/fescar/common/util/StringUtils.java b/common/src/main/java/com/alibaba/fescar/common/util/StringUtils.java
index e827d0f0d..f4f20e556 100644
--- a/common/src/main/java/com/alibaba/fescar/common/util/StringUtils.java
+++ b/common/src/main/java/com/alibaba/fescar/common/util/StringUtils.java
@@ -39,7 +39,7 @@ public class StringUtils {
      * @param str the str
      * @return the boolean
      */
-    public static final boolean isEmpty(String str) {
+    public static final boolean isNullOrEmpty(String str) {
         return (str == null) || (str.isEmpty());
     }
 
diff --git a/core/src/main/java/com/alibaba/fescar/core/rpc/ChannelManager.java b/core/src/main/java/com/alibaba/fescar/core/rpc/ChannelManager.java
index 758a38602..47fea51d1 100644
--- a/core/src/main/java/com/alibaba/fescar/core/rpc/ChannelManager.java
+++ b/core/src/main/java/com/alibaba/fescar/core/rpc/ChannelManager.java
@@ -22,17 +22,15 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-
 import com.alibaba.fescar.common.Constants;
 import com.alibaba.fescar.common.exception.FrameworkException;
+import com.alibaba.fescar.common.util.StringUtils;
 import com.alibaba.fescar.core.protocol.IncompatibleVersionException;
 import com.alibaba.fescar.core.protocol.RegisterRMRequest;
 import com.alibaba.fescar.core.protocol.RegisterTMRequest;
 import com.alibaba.fescar.core.protocol.Version;
 import com.alibaba.fescar.core.rpc.netty.NettyPoolKey.TransactionRole;
-
 import io.netty.channel.Channel;
-import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -233,7 +231,7 @@ public class ChannelManager {
     }
 
     private static Set<String> dbKeytoSet(String dbkey) {
-        if (StringUtils.isEmpty(dbkey)) {
+        if (StringUtils.isNullOrEmpty(dbkey)) {
             return null;
         }
         Set<String> set = new HashSet<String>();
diff --git a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java
index 0c61bef77..610582fed 100644
--- a/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java
+++ b/core/src/main/java/com/alibaba/fescar/core/rpc/netty/TmRpcClient.java
@@ -31,7 +31,7 @@ import com.alibaba.fescar.common.XID;
 import com.alibaba.fescar.common.exception.FrameworkErrorCode;
 import com.alibaba.fescar.common.exception.FrameworkException;
 import com.alibaba.fescar.common.thread.NamedThreadFactory;
-import com.alibaba.fescar.common.thread.RejectedPolicys;
+import com.alibaba.fescar.common.thread.RejectedPolicies;
 import com.alibaba.fescar.common.util.NetUtil;
 import com.alibaba.fescar.config.Configuration;
 import com.alibaba.fescar.config.ConfigurationFactory;
@@ -126,7 +126,7 @@ public final class TmRpcClient extends AbstractRpcRemotingClient {
                         new LinkedBlockingQueue(MAX_QUEUE_SIZE),
                         new NamedThreadFactory(nettyClientConfig.getTmDispatchThreadPrefix(),
                             nettyClientConfig.getClientWorkerThreads()),
-                        RejectedPolicys.runsOldestTaskPolicy());
+                        RejectedPolicies.runsOldestTaskPolicy());
                     instance = new TmRpcClient(nettyClientConfig, null, threadPoolExecutor);
                 }
             }
diff --git a/core/src/main/java/com/alibaba/fescar/core/service/ServiceManagerStaticConfigImpl.java b/core/src/main/java/com/alibaba/fescar/core/service/ServiceManagerStaticConfigImpl.java
index b701fc626..45b638152 100644
--- a/core/src/main/java/com/alibaba/fescar/core/service/ServiceManagerStaticConfigImpl.java
+++ b/core/src/main/java/com/alibaba/fescar/core/service/ServiceManagerStaticConfigImpl.java
@@ -63,7 +63,7 @@ public class ServiceManagerStaticConfigImpl implements ServiceManager {
         }
         String rGroupDataId = ConfigurationKeys.SERVICE_PREFIX + rGroup + ConfigurationKeys.GROUPLIST_POSTFIX;
         String serverListConfig = configuration.getConfig(rGroupDataId);
-        if (StringUtils.isEmpty(serverListConfig)) {
+        if (StringUtils.isNullOrEmpty(serverListConfig)) {
             throw new FrameworkException(InvalidConfiguration);
         }
         serverAddresses = serverListConfig.split(SERVER_NODE_SPLIT_CHAR);
diff --git a/discovery/src/main/java/com/alibaba/fescar/discovery/registry/FileRegistryServiceImpl.java b/discovery/src/main/java/com/alibaba/fescar/discovery/registry/FileRegistryServiceImpl.java
index 11176f35f..586ede4fb 100644
--- a/discovery/src/main/java/com/alibaba/fescar/discovery/registry/FileRegistryServiceImpl.java
+++ b/discovery/src/main/java/com/alibaba/fescar/discovery/registry/FileRegistryServiceImpl.java
@@ -19,13 +19,11 @@ package com.alibaba.fescar.discovery.registry;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.List;
-
+import com.alibaba.fescar.common.util.StringUtils;
 import com.alibaba.fescar.config.ConfigChangeListener;
 import com.alibaba.fescar.config.Configuration;
 import com.alibaba.fescar.config.ConfigurationFactory;
 
-import org.apache.commons.lang.StringUtils;
-
 /**
  * The type File registry service.
  *
@@ -85,7 +83,7 @@ public class FileRegistryServiceImpl implements RegistryService<ConfigChangeList
         }
         String endpointStr = CONFIG.getConfig(
             PREFIX_SERVICE_ROOT + CONFIG_SPLIT_CHAR + clusterName + POSTFIX_GROUPLIST);
-        if (StringUtils.isEmpty(endpointStr)) {
+        if (StringUtils.isNullOrEmpty(endpointStr)) {
             throw new IllegalArgumentException(clusterName + POSTFIX_GROUPLIST + " is required");
         }
         String[] endpoints = endpointStr.split(ENDPOINT_SPLIT_CHAR);
diff --git a/discovery/src/main/java/com/alibaba/fescar/discovery/registry/RedisRegistryServiceImpl.java b/discovery/src/main/java/com/alibaba/fescar/discovery/registry/RedisRegistryServiceImpl.java
index 31b758d8d..f76af35ad 100644
--- a/discovery/src/main/java/com/alibaba/fescar/discovery/registry/RedisRegistryServiceImpl.java
+++ b/discovery/src/main/java/com/alibaba/fescar/discovery/registry/RedisRegistryServiceImpl.java
@@ -115,7 +115,7 @@ public class RedisRegistryServiceImpl implements RegistryService<RedisListener>
         if (minEvictableIdleTimeMillis > 0) {
             redisConfig.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
         }
-        if (StringUtils.isEmpty(password)) {
+        if (StringUtils.isNullOrEmpty(password)) {
             jedisPool = new JedisPool(redisConfig, host, port, Protocol.DEFAULT_TIMEOUT, null, db);
         } else {
             jedisPool = new JedisPool(redisConfig, host, port, Protocol.DEFAULT_TIMEOUT, password, db);
diff --git a/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/exec/SelectForUpdateExecutor.java b/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/exec/SelectForUpdateExecutor.java
index d6e16be73..3a6784a9a 100644
--- a/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/exec/SelectForUpdateExecutor.java
+++ b/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/exec/SelectForUpdateExecutor.java
@@ -70,7 +70,7 @@ public class SelectForUpdateExecutor<S extends Statement> extends BaseTransactio
         } else {
             whereCondition = recognizer.getWhereCondition();
         }
-        if (!StringUtils.isEmpty(whereCondition)) {
+        if (!StringUtils.isNullOrEmpty(whereCondition)) {
             selectSQLAppender.append(" WHERE " + whereCondition);
         }
         selectSQLAppender.append(" FOR UPDATE");
diff --git a/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/sql/struct/TableMetaCache.java b/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/sql/struct/TableMetaCache.java
index c33847f3d..a6d7d4742 100755
--- a/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/sql/struct/TableMetaCache.java
+++ b/rm-datasource/src/main/java/com/alibaba/fescar/rm/datasource/sql/struct/TableMetaCache.java
@@ -23,14 +23,12 @@ import java.sql.SQLException;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
-
 import com.alibaba.druid.pool.DruidDataSource;
-import com.alibaba.druid.util.StringUtils;
 import com.alibaba.fescar.common.exception.ShouldNeverHappenException;
 import com.alibaba.fescar.core.context.RootContext;
 import com.alibaba.fescar.rm.datasource.AbstractConnectionProxy;
 import com.alibaba.fescar.rm.datasource.DataSourceProxy;
-
+import com.alibaba.druid.util.StringUtils;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 
@@ -144,7 +142,7 @@ public class TableMetaCache {
             col.setTableName(tableName);
             col.setColumnName(rs2.getString("COLUMN_NAME"));
             String datatype = rs2.getString("DATA_TYPE");
-            if (StringUtils.equalsIgnoreCase(datatype, "NUMBER")) {
+            if (com.alibaba.druid.util.StringUtils.equalsIgnoreCase(datatype, "NUMBER")) {
                 col.setDataType(java.sql.Types.BIGINT);
             } else if (StringUtils.equalsIgnoreCase(datatype, "VARCHAR2")) {
                 col.setDataType(java.sql.Types.VARCHAR);
diff --git a/server/src/main/java/com/alibaba/fescar/server/lock/DefaultLockManagerImpl.java b/server/src/main/java/com/alibaba/fescar/server/lock/DefaultLockManagerImpl.java
index 9e2cac25f..833bdaa58 100644
--- a/server/src/main/java/com/alibaba/fescar/server/lock/DefaultLockManagerImpl.java
+++ b/server/src/main/java/com/alibaba/fescar/server/lock/DefaultLockManagerImpl.java
@@ -57,7 +57,7 @@ public class DefaultLockManagerImpl implements LockManager {
         ConcurrentHashMap<Map<String, Long>, Set<String>> bucketHolder = branchSession.getLockHolder();
 
         String lockKey = branchSession.getLockKey();
-        if (StringUtils.isEmpty(lockKey)) {
+        if (StringUtils.isNullOrEmpty(lockKey)) {
             return true;
         }
 
diff --git a/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionScanner.java b/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionScanner.java
index 071ed5d51..b17a75b9f 100644
--- a/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionScanner.java
+++ b/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionScanner.java
@@ -20,15 +20,13 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Set;
-
 import com.alibaba.fescar.common.exception.NotSupportYetException;
+import com.alibaba.fescar.common.util.StringUtils;
 import com.alibaba.fescar.config.ConfigurationFactory;
 import com.alibaba.fescar.rm.RMClientAT;
 import com.alibaba.fescar.tm.TMClient;
 import com.alibaba.fescar.tm.api.DefaultFailureHandlerImpl;
 import com.alibaba.fescar.tm.api.FailureHandler;
-
-import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.aop.Advisor;
@@ -146,7 +144,7 @@ public class GlobalTransactionScanner extends AbstractAutoProxyCreator implement
         if (LOGGER.isInfoEnabled()) {
             LOGGER.info("Initializing Global Transaction Clients ... ");
         }
-        if (StringUtils.isEmpty(applicationId) || StringUtils.isEmpty(txServiceGroup)) {
+        if (StringUtils.isNullOrEmpty(applicationId) || StringUtils.isNullOrEmpty(txServiceGroup)) {
             throw new IllegalArgumentException(
                 "applicationId: " + applicationId + ", txServiceGroup: " + txServiceGroup);
         }
diff --git a/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionalInterceptor.java b/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionalInterceptor.java
index f5b664b68..d18053000 100644
--- a/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionalInterceptor.java
+++ b/spring/src/main/java/com/alibaba/fescar/spring/annotation/GlobalTransactionalInterceptor.java
@@ -105,7 +105,7 @@ public class GlobalTransactionalInterceptor implements MethodInterceptor {
                 @Override
                 public String name() {
                     String name = globalTrxAnno.name();
-                    if (!StringUtils.isEmpty(name)) {
+                    if (!StringUtils.isNullOrEmpty(name)) {
                         return name;
                     }
                     return formatMethod(methodInvocation.getMethod());


Test patch:
diff --git a/common/src/test/java/com/alibaba/fescar/common/thread/RejectedPolicysTest.java b/common/src/test/java/com/alibaba/fescar/common/thread/RejectedPoliciesTest.java
similarity index 97%
rename from common/src/test/java/com/alibaba/fescar/common/thread/RejectedPolicysTest.java
rename to common/src/test/java/com/alibaba/fescar/common/thread/RejectedPoliciesTest.java
index 64e90e715..8f8c84f4c 100644
--- a/common/src/test/java/com/alibaba/fescar/common/thread/RejectedPolicysTest.java
+++ b/common/src/test/java/com/alibaba/fescar/common/thread/RejectedPoliciesTest.java
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 /**
  * Created by guoyao on 2019/2/26.
  */
-public class RejectedPolicysTest {
+public class RejectedPoliciesTest {
 
     private final int DEFAULT_CORE_POOL_SIZE = 1;
     private final int DEFAULT_KEEP_ALIVE_TIME = 10;
@@ -48,7 +48,7 @@ public class RejectedPolicysTest {
                 TimeUnit.MILLISECONDS,
                 new LinkedBlockingQueue(MAX_QUEUE_SIZE),
                 new NamedThreadFactory("OldestRunsPolicy", DEFAULT_CORE_POOL_SIZE),
-                RejectedPolicys.runsOldestTaskPolicy());
+                RejectedPolicies.runsOldestTaskPolicy());
         CountDownLatch downLatch1 = new CountDownLatch(1);
         CountDownLatch downLatch2 = new CountDownLatch(1);
         CountDownLatch downLatch3 = new CountDownLatch(1);
diff --git a/common/src/test/java/com/alibaba/fescar/common/util/StringUtilsTest.java b/common/src/test/java/com/alibaba/fescar/common/util/StringUtilsTest.java
index 23feaa780..7cd96e0e4 100644
--- a/common/src/test/java/com/alibaba/fescar/common/util/StringUtilsTest.java
+++ b/common/src/test/java/com/alibaba/fescar/common/util/StringUtilsTest.java
@@ -16,13 +16,10 @@
 
 package com.alibaba.fescar.common.util;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.sql.SQLException;
-
 import javax.sql.rowset.serial.SerialBlob;
-
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -40,11 +37,12 @@ public class StringUtilsTest {
      * Test is empty.
      */
     @Test
-    public void testIsEmpty() {
-        assertThat(StringUtils.isEmpty(null)).isTrue();
-        assertThat(StringUtils.isEmpty("abc")).isFalse();
-        assertThat(StringUtils.isEmpty("")).isTrue();
-        assertThat(StringUtils.isEmpty(" ")).isFalse();
+    public void testIsNullOrEmpty() {
+
+        assertThat(StringUtils.isNullOrEmpty(null)).isTrue();
+        assertThat(StringUtils.isNullOrEmpty("abc")).isFalse();
+        assertThat(StringUtils.isNullOrEmpty("")).isTrue();
+        assertThat(StringUtils.isNullOrEmpty(" ")).isFalse();
     }
 
     /**
@@ -80,16 +78,9 @@ public class StringUtilsTest {
      */
     @Test
     @Ignore
-    public void testInputStream2String() {
-        try {
-            InputStream inputStream = StringUtilsTest.class.getClassLoader().getResourceAsStream("test.txt");
-            assertThat(StringUtils.inputStream2String(inputStream)).isEqualTo("abc\n"
-                + ":\"klsdf\n"
-                + "2ks,x:\".,-3sd˚ø≤ø¬≥");
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+    public void testInputStream2String() throws IOException {
+        InputStream inputStream = StringUtilsTest.class.getClassLoader().getResourceAsStream("test.txt");
+        assertThat(StringUtils.inputStream2String(inputStream))
+            .isEqualTo("abc\n" + ":\"klsdf\n" + "2ks,x:\".,-3sd˚ø≤ø¬≥");
     }
 }
diff --git a/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessImpl.java b/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessImpl.java
index 00d9978e4..5f87ac928 100644
--- a/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessImpl.java
+++ b/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessImpl.java
@@ -20,12 +20,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class BusinessImpl implements Business {
-    Logger logger = LoggerFactory.getLogger(BusinessImpl.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(BusinessImpl.class);
 
     @Override
     @GlobalTransactional(timeoutMills = 300000, name = "busi-doBiz")
     public String doBiz(String msg) {
-        logger.info("Business doBiz");
+        LOGGER.info("Business doBiz");
         return "hello " + msg;
     }
 }
diff --git a/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessProxy.java b/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessProxy.java
index e4b65e10b..46637e796 100644
--- a/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessProxy.java
+++ b/spring/src/test/java/com/alibaba/fescar/spring/annotation/BusinessProxy.java
@@ -16,10 +16,16 @@
 
 package com.alibaba.fescar.spring.annotation;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 
 public class BusinessProxy implements InvocationHandler {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(BusinessProxy.class);
+
     private Object proxy;
 
     public BusinessProxy(Object proxy) {
@@ -27,15 +33,20 @@ public class BusinessProxy implements InvocationHandler {
     }
 
     @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        System.out.println("before");
+    public Object invoke(Object proxy, Method method, Object[] args) {
+        if (LOGGER.isDebugEnabled()) {
+            LOGGER.debug("Before invoking proxy method.");
+        }
         Object result = null;
         try {
             result = method.invoke(this.proxy, args);
         } catch (Exception e) {
-
+            LOGGER.warn("Failed to invoke method {}.", method.getName());
+        }
+        if (LOGGER.isDebugEnabled()) {
+            LOGGER.debug("After invoking proxy method.");
         }
-        System.out.println("after");
+
         return result;
     }
 }
diff --git a/spring/src/test/java/com/alibaba/fescar/spring/annotation/MethodDescTest.java b/spring/src/test/java/com/alibaba/fescar/spring/annotation/MethodDescTest.java
new file mode 100644
index 000000000..8d51e0226
--- /dev/null
+++ b/spring/src/test/java/com/alibaba/fescar/spring/annotation/MethodDescTest.java
@@ -0,0 +1,88 @@
+/*
+ *  Copyright 1999-2018 Alibaba Group Holding Ltd.
+ *
+ *  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
+ *
+ *       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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package com.alibaba.fescar.spring.annotation;
+
+import org.junit.Test;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * @author Wu
+ * @date 2019/3/8
+ */
+public class MethodDescTest {
+
+    private static final GlobalTransactionScanner GLOBAL_TRANSACTION_SCANNER = new GlobalTransactionScanner("global-trans-scanner-test");
+    private static Method method = null;
+    private static GlobalTransactional transactional = null;
+
+    public MethodDescTest() throws NoSuchMethodException {
+        method = MockBusiness.class.getDeclaredMethod("doBiz", String.class);
+        transactional = method.getAnnotation(GlobalTransactional.class);
+    }
+
+    @Test
+    public void testGetTransactionAnnotation() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        MethodDesc methodDesc = getMethodDesc();
+        assertThat(methodDesc.getTransactionAnnotation()).isEqualTo(transactional);
+
+    }
+
+    @Test
+    public void testGetMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        MethodDesc methodDesc = getMethodDesc();
+        assertThat(methodDesc.getMethod()).isEqualTo(method);
+    }
+
+    @Test
+    public void testSetTransactionAnnotation() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        MethodDesc methodDesc = getMethodDesc();
+        assertThat(methodDesc.getTransactionAnnotation()).isNotNull();
+        methodDesc.setTransactionAnnotation(null);
+        assertThat(methodDesc.getTransactionAnnotation()).isNull();
+    }
+
+    @Test
+    public void testSetMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        MethodDesc methodDesc = getMethodDesc();
+        assertThat(methodDesc.getMethod()).isNotNull();
+        methodDesc.setMethod(null);
+        assertThat(methodDesc.getMethod()).isNull();
+    }
+
+
+    private MethodDesc getMethodDesc() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        //call the private method
+        Method m = GlobalTransactionScanner.class.getDeclaredMethod("makeMethodDesc", GlobalTransactional.class, Method.class);
+        m.setAccessible(true);
+        return (MethodDesc) m.invoke(GLOBAL_TRANSACTION_SCANNER, transactional, method);
+
+    }
+
+    /**
+     * the type mock business
+     */
+    private static class MockBusiness {
+        @GlobalTransactional(timeoutMills = 300000, name = "busi-doBiz")
+        public String doBiz(String msg) {
+            return "hello " + msg;
+        }
+    }
+
+}