Merge branch 'uat' into 'master'

阻断代码合并

See merge request eshop/biz_service_ebtp_extend!78
This commit is contained in:
张芹彬
2022-03-22 11:47:44 +08:00
2 changed files with 37 additions and 37 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.chinaunicom.ebtp</groupId>
<artifactId>mall-ebtp-cloud-parent</artifactId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</parent>
<groupId>com.chinaunicom.mall.ebtp</groupId>
@ -20,7 +20,7 @@
<dependency>
<groupId>com.chinaunicom.mall.ebtp</groupId>
<artifactId>uboot-core</artifactId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</dependency>

View File

@ -294,31 +294,31 @@ public final class Utils {
}
}
public static Properties parseGrpcUrl(String url) {
if (isNullOrEmpty(url)) {
throw new RuntimeException("URL cannot be null or empty");
}
Properties props = new Properties();
final String regex = "([^:]+)[:]//([^:]+)[:]([0-9]+)";
final Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(url);
if (m.matches()) {
props.setProperty("protocol", m.group(1));
props.setProperty("host", m.group(2));
props.setProperty("port", m.group(3));
String protocol = props.getProperty("protocol");
if (!"grpc".equals(protocol) && !"grpcs".equals(protocol)) {
throw new RuntimeException(format("Invalid protocol expected grpc or grpcs and found %s.", protocol));
}
} else {
throw new RuntimeException("URL must be of the format protocol://host:port. Found: '" + url + "'");
}
// TODO: allow all possible formats of the URL
return props;
}
// public static Properties parseGrpcUrl(String url) {
// if (isNullOrEmpty(url)) {
// throw new RuntimeException("URL cannot be null or empty");
// }
//
// Properties props = new Properties();
// final String regex = "([^:]+)[:]//([^:]+)[:]([0-9]+)";
// final Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
// Matcher m = p.matcher(url);
// if (m.matches()) {
// props.setProperty("protocol", m.group(1));
// props.setProperty("host", m.group(2));
// props.setProperty("port", m.group(3));
//
// String protocol = props.getProperty("protocol");
// if (!"grpc".equals(protocol) && !"grpcs".equals(protocol)) {
// throw new RuntimeException(format("Invalid protocol expected grpc or grpcs and found %s.", protocol));
// }
// } else {
// throw new RuntimeException("URL must be of the format protocol://host:port. Found: '" + url + "'");
// }
//
// // TODO: allow all possible formats of the URL
// return props;
// }
/**
* Check if the strings Grpc url is valid
@ -326,16 +326,16 @@ public final class Utils {
* @param url
* @return Return the io.seata.core.exception that indicates the error or null if ok.
*/
public static Exception checkGrpcUrl(String url) {
try {
parseGrpcUrl(url);
return null;
} catch (Exception e) {
return e;
}
}
// public static Exception checkGrpcUrl(String url) {
// try {
//
// parseGrpcUrl(url);
// return null;
//
// } catch (Exception e) {
// return e;
// }
// }
/**
* Check if a string is null or empty.