From 3e7e181f8a21ccfc1690aec8f8db108655dce345 Mon Sep 17 00:00:00 2001 From: lowzj Date: Mon, 20 Mar 2017 18:00:54 +0800 Subject: [PATCH] polish ConsulEcwidClient * upgrade consul-api to 1.2.1 * use GetValue#getDecodedValue * typo: ConsulServcies --> ConsulServices --- motan-registry-consul/pom.xml | 2 +- .../registry/consul/client/ConsulEcwidClient.java | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/motan-registry-consul/pom.xml b/motan-registry-consul/pom.xml index 2367f987e..b792d1e17 100644 --- a/motan-registry-consul/pom.xml +++ b/motan-registry-consul/pom.xml @@ -37,7 +37,7 @@ com.ecwid.consul consul-api - 1.1.4 + 1.2.1 diff --git a/motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/client/ConsulEcwidClient.java b/motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/client/ConsulEcwidClient.java index 62683d0bb..1bb1ac66e 100644 --- a/motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/client/ConsulEcwidClient.java +++ b/motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/client/ConsulEcwidClient.java @@ -12,7 +12,6 @@ import com.weibo.api.motan.registry.consul.ConsulService; import com.weibo.api.motan.registry.consul.ConsulUtils; import com.weibo.api.motan.util.LoggerUtil; -import org.apache.commons.codec.binary.Base64; import java.util.ArrayList; import java.util.List; @@ -54,13 +53,13 @@ public ConsulResponse> lookupHealthService( if (orgResponse != null && orgResponse.getValue() != null && !orgResponse.getValue().isEmpty()) { List HealthServices = orgResponse.getValue(); - List ConsulServcies = new ArrayList( + List ConsulServices = new ArrayList( HealthServices.size()); for (HealthService orgService : HealthServices) { try { ConsulService newService = convertToConsulService(orgService); - ConsulServcies.add(newService); + ConsulServices.add(newService); } catch (Exception e) { String servcieid = "null"; if (orgService.getService() != null) { @@ -71,9 +70,9 @@ public ConsulResponse> lookupHealthService( + servcieid, e); } } - if (!ConsulServcies.isEmpty()) { + if (!ConsulServices.isEmpty()) { newResponse = new ConsulResponse>(); - newResponse.setValue(ConsulServcies); + newResponse.setValue(ConsulServices); newResponse.setConsulIndex(orgResponse.getConsulIndex()); newResponse.setConsulLastContact(orgResponse .getConsulLastContact()); @@ -93,7 +92,7 @@ public String lookupCommand(String group) { if (value == null) { LoggerUtil.info("no command in group: " + group); } else if (value.getValue() != null) { - command = new String(Base64.decodeBase64(value.getValue())); + command = value.getDecodedValue(); } return command; }