jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds] [Softlayer] Implements setting and retrieving the notes property (#756)
Date Tue, 09 Jun 2015 21:56:43 GMT
> @@ -213,6 +218,15 @@ public SoftLayerComputeServiceAdapter(SoftLayerApi api,
>           api.getVirtualGuestApi().setTags(result.getId(), templateOptions.getTags());
>        }
>  
> +      Map<String, String> meta = templateOptions.getUserMetadata();
> +      if (meta != null) {
> +         String notes = meta.get(USER_META_NOTES);
> +         if (!Strings.isNullOrEmpty(notes)) {
> +            checkArgument(notes.length() <= USER_META_NOTES_MAX_LENGTH, "'notes'
property in user metadata should be long at most " + USER_META_NOTES_MAX_LENGTH + " characters.");

Failing at this point may leak the virtual guest that is created a few lines before. You'd
better validate this at the beginning of the method to fail fast and avoid creating unnecessary
resources.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/756/files#r32069223
Mime
View raw message