diff options
| author | qidaijie <[email protected]> | 2021-11-05 10:02:06 +0300 |
|---|---|---|
| committer | qidaijie <[email protected]> | 2021-11-05 10:02:06 +0300 |
| commit | 159d00cfb01fef404cc6b565bd1e3df668f29644 (patch) | |
| tree | ccca5b09c3f55d1c612b76f6df607e2a25985f13 | |
| parent | f8706bfa1d8eb5d854b63c1f05dbdea72da542ed (diff) | |
增加jsonpath解析判断(TSG-8341)
| -rw-r--r-- | pom.xml | 2 | ||||
| -rw-r--r-- | src/main/java/com/zdjizhi/utils/general/TransFunction.java | 12 |
2 files changed, 6 insertions, 8 deletions
@@ -6,7 +6,7 @@ <groupId>com.zdjizhi</groupId> <artifactId>log-completion-schema</artifactId> - <version>210908-security</version> + <version>211105-flattenSpec</version> <name>log-completion-schema</name> <url>http://www.example.com</url> diff --git a/src/main/java/com/zdjizhi/utils/general/TransFunction.java b/src/main/java/com/zdjizhi/utils/general/TransFunction.java index 7dc806e..f02abc0 100644 --- a/src/main/java/com/zdjizhi/utils/general/TransFunction.java +++ b/src/main/java/com/zdjizhi/utils/general/TransFunction.java @@ -91,11 +91,7 @@ class TransFunction { * @return account */ static String radiusMatch(String ip) { - String account = HBaseUtils.getAccount(ip.trim()); -// if (StringUtil.isBlank(account)) { -// logger.warn("HashMap get account is null, Ip is :" + ip); -// } - return account; + return HBaseUtils.getAccount(ip.trim()); } /** @@ -164,9 +160,11 @@ class TransFunction { try { if (StringUtil.isNotBlank(expr)) { ArrayList<String> read = JsonPath.parse(message).read(expr); - flattenResult = read.get(0); + if (read.size() >= 1) { + flattenResult = read.get(0); + } } - } catch (ClassCastException | InvalidPathException e) { + } catch (ClassCastException | InvalidPathException | ArrayIndexOutOfBoundsException e) { logger.error("设备标签解析异常,[ " + expr + " ]解析表达式错误" + e); } return flattenResult; |
