jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Everett Toews <notificati...@github.com>
Subject Re: [jclouds-labs-openstack] Poppy service api (#179)
Date Mon, 09 Mar 2015 11:44:25 GMT
> +   @Override
> +   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object>
postParams) {
> +      String jsonPatch = null;
> +      Service service = (Service) postParams.get("service");
> +
> +      Json json = Guice.createInjector(new GsonModule()).getInstance(Json.class);
> +
> +      String targetService = json.toJson(postParams.get("updateService"));
> +      String sourceService = json.toJson(service.toUpdatableService().build());
> +
> +      ObjectMapper mapper = new ObjectMapper();
> +      try {
> +         jsonPatch = JsonDiff.asJson(mapper.readTree(sourceService), mapper.readTree(targetService)).toString();
> +      } catch (IOException e) {
> +         e.printStackTrace();
> +         throw new RuntimeException("Could not create a JSONPatch");

Don't mask the original exception. Use `RuntimeException(String message, Throwable cause)`
instead.

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