Vinzenz Feenstra has posted comments on this change.

Change subject: Mark VM as problematic when timezone or OS changed
......................................................................


Patch Set 8:

(3 comments)

https://gerrit.ovirt.org/#/c/30508/8/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/TimeZoneType.java
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/TimeZoneType.java:

Line 223:         String s = getTimeZoneList().get(timeZoneKey);
Line 224:         Match match = Regex.Match(s, TimeZoneExtractTimePattern);
Line 225:         int value = 0;
Line 226:         if(match.success() && match.groups().size() > 0) {
Line 227:             value = 
Integer.parseInt(match.groups().get(0).getValue().substring(3).replace(":", 
"").replace("+", ""));
> this complex expression is copy pasted 3 times already now - please extract
done
Line 228:             boolean neg = value < 0;
Line 229:             if(neg) {
Line 230:                 value *= -1;
Line 231:             }


Line 224:         Match match = Regex.Match(s, TimeZoneExtractTimePattern);
Line 225:         int value = 0;
Line 226:         if(match.success() && match.groups().size() > 0) {
Line 227:             value = 
Integer.parseInt(match.groups().get(0).getValue().substring(3).replace(":", 
"").replace("+", ""));
Line 228:             boolean neg = value < 0;
> instead of this you could do "value = Math.abs(value);"
using abs now
Line 229:             if(neg) {
Line 230:                 value *= -1;
Line 231:             }
Line 232:             value = ((value / 100) * 60 + value % 100);


Line 230:                 value *= -1;
Line 231:             }
Line 232:             value = ((value / 100) * 60 + value % 100);
Line 233:             if(neg) {
Line 234:                 value *= -1;
> here it can not be negative anymore
This makes it negative again, when it was negative
Line 235:             }
Line 236:         }
Line 237:         return value;
Line 238:     }


-- 
To view, visit https://gerrit.ovirt.org/30508
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia1d6c878a3e700998c77d3ee3248b4ef3302d08b
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Betak <[email protected]>
Gerrit-Reviewer: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[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