You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/12/02 09:56:08 UTC
[skywalking] branch bugfix/oal-string-match created (now 5df37e7)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a change to branch bugfix/oal-string-match
in repository https://gitbox.apache.org/repos/asf/skywalking.git.
at 5df37e7 Fix potential NPE in OAL string match and a bug when right-hand-side variable includes double quotes
This branch includes the following new commits:
new 5df37e7 Fix potential NPE in OAL string match and a bug when right-hand-side variable includes double quotes
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[skywalking] 01/01: Fix potential NPE in OAL string match and a bug when right-hand-side variable includes double quotes
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch bugfix/oal-string-match
in repository https://gitbox.apache.org/repos/asf/skywalking.git
commit 5df37e73df99074373bab9d0e52c87d6217c7d13
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Thu Dec 2 17:55:48 2021 +0800
Fix potential NPE in OAL string match and a bug when right-hand-side variable includes double quotes
---
CHANGES.md | 1 +
.../oap/server/core/analysis/metrics/expression/StringMatch.java | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index f0f5099..99f87f3 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -64,6 +64,7 @@ Release Notes.
* Remove `logback` dependencies in IoTDB plugin.
* Fix `StorageModuleElasticsearchProvider` doesn't watch on `trustStorePath`.
* Fix a wrong check about entity if GraphQL at the endpoint relation level.
+* Fix potential NPE in OAL string match and a bug when right-hand-side variable includes double quotes.
#### UI
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/StringMatch.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/StringMatch.java
index d0b6b01..9f931fb 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/StringMatch.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/StringMatch.java
@@ -25,12 +25,12 @@ import org.apache.skywalking.oap.server.core.analysis.metrics.annotation.FilterM
public class StringMatch {
public boolean match(String left, String right) {
- if (left.startsWith("\"") && left.endsWith("\"")) {
+ if (left != null && left.startsWith("\"") && left.endsWith("\"")) {
left = left.substring(1, left.length() - 1);
}
- if (right.startsWith("\"") && right.endsWith("\"")) {
- right = left.substring(1, right.length() - 1);
+ if (right != null && right.startsWith("\"") && right.endsWith("\"")) {
+ right = right.substring(1, right.length() - 1);
}
return Objects.equals(left, right);