|
@@ -3,10 +3,11 @@ package com.alibaba.otter.canal.instance.spring.support;
|
|
|
import java.beans.PropertyEditorSupport;
|
|
|
import java.net.InetSocketAddress;
|
|
|
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.PropertyEditorRegistrar;
|
|
|
import org.springframework.beans.PropertyEditorRegistry;
|
|
|
|
|
|
+import com.alibaba.otter.canal.common.utils.AddressUtils;
|
|
|
+
|
|
|
public class SocketAddressEditor extends PropertyEditorSupport implements PropertyEditorRegistrar {
|
|
|
|
|
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
|
@@ -14,7 +15,7 @@ public class SocketAddressEditor extends PropertyEditorSupport implements Proper
|
|
|
}
|
|
|
|
|
|
public void setAsText(String text) throws IllegalArgumentException {
|
|
|
- String[] addresses = StringUtils.split(text, ":");
|
|
|
+ String[] addresses = AddressUtils.splitIPAndPort(text);
|
|
|
if (addresses.length > 0) {
|
|
|
if (addresses.length != 2) {
|
|
|
throw new RuntimeException("address[" + text + "] is illegal, eg.127.0.0.1:3306");
|