Eli Mesika has uploaded a new change for review.

Change subject: core: Underscores in tag names break tags
......................................................................

core: Underscores in tag names break tags

Fixing tag regular expression matching in TagHandler.
We are adding backslashes for the SQL search query but should remove
them when the regular expression is matched.

Change-Id: I0925cdba0ed34e3dc68a8396eca0b17589dfa853
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=949484
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TagsDirector.java
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/17819/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TagsDirector.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TagsDirector.java
index 6d8960f..e06385a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TagsDirector.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TagsDirector.java
@@ -302,6 +302,9 @@
 
     private void RecursiveGetTagsAndChildrenByRegExp(String tagNameRegExp, 
StringBuilder sb, tags tag, TagReturnValueIndicator indicator ) {
         if ((tag.getChildren() != null) && (tag.getChildren().size() > 0)) {
+            // The following line replaces '\\' in the expression that may be 
added by handling a '_' character with empty string.
+            // since we have here both String and RegExp , each backslash char 
is represented by four backslash chars , so for marching 2 we will need 8
+            tagNameRegExp=tagNameRegExp.replaceAll("\\\\\\\\", "");
             for (tags child : tag.getChildren()) {
                 if (Regex.IsMatch(child.gettag_name(), tagNameRegExp))
                 // the tag matches the regular expression -> add it and all its


-- 
To view, visit http://gerrit.ovirt.org/17819
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0925cdba0ed34e3dc68a8396eca0b17589dfa853
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to