Gilad Chaplik has uploaded a new change for review.

Change subject: engine: custom properties: allow '=' in regex
......................................................................

engine: custom properties: allow '=' in regex

In custom properties sheet when regex contains '=', we cannot parse
the string using split('=') (the parsing is invalid).
To solve that added a hard limit of 2 for the string split.

Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
Change-Id: Ic845e2ab5a0f23d48c1506f4f834a851009ea253
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/82/14182/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java
index cf015bc..0c7aa3f 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java
@@ -214,7 +214,7 @@
         for (String property : propertiesStrs) {
 
             Pattern pattern = null;
-            String[] propertyParts = property.split(KEY_VALUE_DELIMETER);
+            String[] propertyParts = property.split(KEY_VALUE_DELIMETER, 2);
             if (propertyParts.length == 1) { // there is no value(regex) for 
the property - we assume
                 // in that case that any value is allowed except for the 
properties delimeter
                 pattern = VALUE_PATTERN;
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java
index 16e61e9..55a54ec 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java
@@ -105,7 +105,7 @@
                     continue;
                 }
 
-                splitLine = line.split("="); //$NON-NLS-1$
+                splitLine = line.split("=", 2); //$NON-NLS-1$
                 String key = splitLine[0];
                 if (allKeyValueMap.containsKey(key)) {
                     keyValueMap_used.put(key, splitLine[1]);
@@ -151,7 +151,7 @@
             if (line.isEmpty()) {
                 continue;
             }
-            splitLine = line.split("="); //$NON-NLS-1$
+            splitLine = line.split("=", 2); //$NON-NLS-1$
             String key = splitLine[0];
             allKeyValueMap.put(key, splitLine[1]);
             ValidationResult valid = 
regexValidation.validate(allKeyValueMap.get(key));


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

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

Reply via email to