[Vmware] Fix for OVF parsing error - #2567
Conversation
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
| od._diskId = disk.getAttribute("ovf:diskId"); | ||
| od._fileRef = disk.getAttribute("ovf:fileRef"); | ||
| od._populatedSize = Long.parseLong(disk.getAttribute("ovf:populatedSize") == null ? "0" : disk.getAttribute("ovf:populatedSize")); | ||
| od._populatedSize = Long.parseLong(StringUtils.isBlank(disk.getAttribute("ovf:populatedSize")) ? "0" : disk.getAttribute("ovf:populatedSize")); |
There was a problem hiding this comment.
Why not use org.apache.commons.lang3.math.NumberUtils.toLong(String) instead?
Then, you do not even need this inline IF
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1912 |
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1913 |
|
@blueorangutan test |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
| od._diskId = disk.getAttribute("ovf:diskId"); | ||
| od._fileRef = disk.getAttribute("ovf:fileRef"); | ||
| od._populatedSize = Long.parseLong(disk.getAttribute("ovf:populatedSize") == null ? "0" : disk.getAttribute("ovf:populatedSize")); | ||
| od._populatedSize = NumberUtils.toLong(disk.getAttribute("ovf:populatedSize")); |
There was a problem hiding this comment.
@nvazquez this can cause exception still -- this should be used with a default value like 0L in case of error. For example like this -- NumberUtils.toLong("string-param", 0L) . Also no tests were ran /cc @DaanHoogland
There was a problem hiding this comment.
@rhtyd NumberUtils.toLong(Sting) calls NumberUtils.toLong(Sting,0L)
There was a problem hiding this comment.
sorry @rhtyd , you are right about the tests. I saw @borisstoyanov 's lgtm and assumed.
There was a problem hiding this comment.
@DaanHoogland cool, I did not know that internally it falls to NumberUtils.toLong(String,0L)
There was a problem hiding this comment.
remains teh question: are we settling for the ci on this one (i did check that before merging) @rhtyd @rafaelweingartner @borisstoyanov ?
There was a problem hiding this comment.
Well, now it is already merged. However, I do not see the need to run those tests again; they are the same tests used when the code was merged, right? Testes passed then, they will pass now. Unless you had a case, which could cause the case that @nvazquez addressed here.
There was a problem hiding this comment.
@DaanHoogland let's kick tests both on master and 4.11 over the weekend. I don't think Nicolas's pr will cause any fail, besides Travis and pkging has passed.
|
Packaging result: ✔centos6 ✖centos7 ✔debian. JID-1919 |
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1925 |
|
Trillian test result (tid-2501)
|
Description
OVF files contained on OVA template files, with missing 'ovf:populatedSize' attribute fail the post download installation.
After template is downloaded, installation fails with error:
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?
Tested on Vmware environment registering a Windows 2012 OVA template.
OVF file didn't include the 'ovf:populatedSize' attribute
Checklist:
Testing
@blueorangutan package