From 7ba75fc70e31b32bc46f6cc0f4ec631ff19254d4 Mon Sep 17 00:00:00 2001 From: Aurelien Poscia Date: Wed, 10 Aug 2022 14:26:39 +0200 Subject: [PATCH] SONAR-17150 fix SSF-39 --- .../main/java/org/sonar/server/language/ws/ListAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/language/ws/ListAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/language/ws/ListAction.java index 5552ed21c73..e26d2765cae 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/language/ws/ListAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/language/ws/ListAction.java @@ -81,11 +81,11 @@ public class ListAction implements WsAction { } private Collection listMatchingLanguages(@Nullable String query, int pageSize) { - Pattern pattern = Pattern.compile(query == null ? MATCH_ALL : MATCH_ALL + Pattern.quote(query) + MATCH_ALL, Pattern.CASE_INSENSITIVE); + Pattern pattern = Pattern.compile(query == null ? MATCH_ALL : Pattern.quote(query), Pattern.CASE_INSENSITIVE); SortedMap languagesByName = Maps.newTreeMap(); for (Language lang : languages.all()) { - if (pattern.matcher(lang.getKey()).matches() || pattern.matcher(lang.getName()).matches()) { + if (pattern.matcher(lang.getKey()).find() || pattern.matcher(lang.getName()).find()) { languagesByName.put(lang.getName(), lang); } } -- 2.39.5