Permalink
Browse files

Fixed PUT when deallocation resources. @jdevesa should also take it i…

…nto account.
  • Loading branch information...
nacx committed Apr 27, 2012
1 parent 6a648ac commit 4786d1687ffdbb74b5943420ff8714a71025f9b8
Showing with 5 additions and 1 deletion.
  1. +5 −1 api/src/main/java/com/abiquo/api/services/cloud/VirtualMachineService.java
@@ -899,8 +899,12 @@ private boolean resourceIntoNewList(final RasdManagement resource,
{
for (RasdManagement newResource : newResources)
{
+ // New resources being attached have a NULL rasd, so we should avoid considering them
+ // when comparing the list to find if the resource is present in the new list. This is
+ // specially notorious in PUT requests
+ if (newResource.getRasd() != null
// Since the values point to the same rasd, the id should be the same
- if (resource.getRasd().getId().equals(newResource.getRasd().getId()))
+ && resource.getRasd().getId().equals(newResource.getRasd().getId()))
{
return true;
}

1 comment on commit 4786d16

@devvesa

This comment has been minimized.

Show comment Hide comment
@devvesa

devvesa Apr 28, 2012

Contributor

ACK

Contributor

devvesa commented on 4786d16 Apr 28, 2012

ACK

Please sign in to comment.