Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/com/cloud/agent/api/storage/OVFHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public List<DatadiskTO> getOVFVolumeInfo(final String ovfFilePath) {
String allocationUnits = disk.getAttribute("ovf:capacityAllocationUnits");
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"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd NumberUtils.toLong(Sting) calls NumberUtils.toLong(Sting,0L)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry @rhtyd , you are right about the tests. I saw @borisstoyanov 's lgtm and assumed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland cool, I did not know that internally it falls to NumberUtils.toLong(String,0L)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remains teh question: are we settling for the ci on this one (i did check that before merging) @rhtyd @rafaelweingartner @borisstoyanov ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.


if ((od._capacity != 0) && (allocationUnits != null)) {

Expand Down