Tomas Jelinek has posted comments on this change.

Change subject: ui: remove last delimiter in CustomProperties
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.ovirt.org/#/c/29891/1/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java:

Line 138:             }
Line 139:             builder.append(PROPERTIES_DELIMETER);
Line 140:         }
Line 141:         // remove the last delimiter
Line 142:         return builder.subSequence(0, builder.length() - 
1).toString();
This could fail if in two cases:

1: if no values added to the builder, this fails in index array out of bound...

2: if someone changes the PROPERTIES_DELIMETER to a different one which has 
more than one char this would cut only the last part.

I'd write it somehow like this:
if(builder.toString().endsWith(PROPERTIES_DELIMITER))  {
  return builder.subSequence(0, builder.length() - 
PROPERTIES_DELIMETER.lengt()).toString();
}

return buildet.toString();
Line 143:     }
Line 144: 
Line 145:     public boolean validate() {
Line 146:         setIsValid(true);


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3909f97cf2e02845c41a25bf5ca6f8327a6da3cd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <[email protected]>
Gerrit-Reviewer: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to