增加jsonpath解析判断(TSG-8341)
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.zdjizhi</groupId>
|
<groupId>com.zdjizhi</groupId>
|
||||||
<artifactId>log-completion-schema</artifactId>
|
<artifactId>log-completion-schema</artifactId>
|
||||||
<version>210908-security</version>
|
<version>211105-flattenSpec</version>
|
||||||
|
|
||||||
<name>log-completion-schema</name>
|
<name>log-completion-schema</name>
|
||||||
<url>http://www.example.com</url>
|
<url>http://www.example.com</url>
|
||||||
|
|||||||
@@ -91,11 +91,7 @@ class TransFunction {
|
|||||||
* @return account
|
* @return account
|
||||||
*/
|
*/
|
||||||
static String radiusMatch(String ip) {
|
static String radiusMatch(String ip) {
|
||||||
String account = HBaseUtils.getAccount(ip.trim());
|
return HBaseUtils.getAccount(ip.trim());
|
||||||
// if (StringUtil.isBlank(account)) {
|
|
||||||
// logger.warn("HashMap get account is null, Ip is :" + ip);
|
|
||||||
// }
|
|
||||||
return account;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,9 +160,11 @@ class TransFunction {
|
|||||||
try {
|
try {
|
||||||
if (StringUtil.isNotBlank(expr)) {
|
if (StringUtil.isNotBlank(expr)) {
|
||||||
ArrayList<String> read = JsonPath.parse(message).read(expr);
|
ArrayList<String> read = JsonPath.parse(message).read(expr);
|
||||||
|
if (read.size() >= 1) {
|
||||||
flattenResult = read.get(0);
|
flattenResult = read.get(0);
|
||||||
}
|
}
|
||||||
} catch (ClassCastException | InvalidPathException e) {
|
}
|
||||||
|
} catch (ClassCastException | InvalidPathException | ArrayIndexOutOfBoundsException e) {
|
||||||
logger.error("设备标签解析异常,[ " + expr + " ]解析表达式错误" + e);
|
logger.error("设备标签解析异常,[ " + expr + " ]解析表达式错误" + e);
|
||||||
}
|
}
|
||||||
return flattenResult;
|
return flattenResult;
|
||||||
|
|||||||
Reference in New Issue
Block a user