Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1530#discussion_r62282416 --- Diff: vmware-base/src/com/cloud/hypervisor/vmware/mo/VmdkFileDescriptor.java --- @@ -47,25 +49,28 @@ public void parse(byte[] vmdkFileContent) throws IOException { while ((line = in.readLine()) != null) { // ignore empty and comment lines line = line.trim(); - if (line.isEmpty()) + if (line.isEmpty()) { continue; - if (line.charAt(0) == '#') + } + if (line.charAt(0) == '#') { continue; + } - String[] tokens = line.split("="); + final String[] tokens = line.split("="); if (tokens.length == 2) { - String name = tokens[0].trim(); + final String name = tokens[0].trim(); String value = tokens[1].trim(); - if (value.charAt(0) == '\"') + if (value.charAt(0) == '\"') { value = value.substring(1, value.length() - 1); + } _properties.put(name, value); } else { if (line.startsWith("RW")) { - int startPos = line.indexOf('\"'); - int endPos = line.lastIndexOf('\"'); - assert (startPos > 0); - assert (endPos > 0); + final int startPos = line.indexOf('\"'); + final int endPos = line.lastIndexOf('\"'); + assert startPos > 0; + assert endPos > 0; --- End diff -- Should ``endPos`` be greater than or equal to ``startPos``? If so, it would make sense to add an assertion for that condition. Also, CloudStack doesn't seem to be run with assertions enabled. Consider using Guava's ``Preconditions.checkState`` which will throw an ``IllegalStateException`` when an assertion fails.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---