Source:
public Response putGeolocation(final String accountSid, final MultivaluedMap<String, String> data, GeolocationType geolocationType, final MediaType responseType) { try { secure(accountsDao.getAccount(accountSid), "RestComm:Create:Geolocation"); secureLevelControl(accountsDao, accountSid, null); } catch (final AuthorizationException exception) { return status(UNAUTHORIZED).build(); } try { if (!geolocationType.toString().equalsIgnoreCase("Immediate") && !geolocationType.toString().equalsIgnoreCase("Notification")) { validateGeolocationType(data); } } catch (final NullPointerException exception) { return status(BAD_REQUEST).entity(exception.getMessage()).build(); } Geolocation geolocation = createFrom(new Sid(accountSid), data, geolocationType); if (geolocation.getResponseStatus() != null && geolocation.getResponseStatus().equalsIgnoreCase("rejected")) { System.out.println("Geolocation ResponseStatus rejected or unauthorized for that Sid"); if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(geolocation); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(geolocation), APPLICATION_JSON).build(); } else { return null; } } else { dao.addGeolocation(geolocation); if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(geolocation); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(geolocation), APPLICATION_JSON).build(); } else { return null; } } }

Target:
public Response putGeolocation(final String accountSid, final MultivaluedMap<String, String> data, GeolocationType geolocationType, final MediaType responseType) { Account account; try { account = accountsDao.getAccount(accountSid); secure(account, "RestComm:Create:Geolocation", SecuredType.SECURED_APP); } catch (final AuthorizationException exception) { return status(UNAUTHORIZED).build(); } try { validate(data, geolocationType); } catch (final NullPointerException nullPointerException) { return status(BAD_REQUEST).entity(nullPointerException.getMessage()).build(); } catch (final IllegalArgumentException illegalArgumentException) { cause = illegalArgumentException.getMessage(); rStatus = responseStatus.Failed.toString(); } catch (final UnsupportedOperationException unsupportedOperationException) { return status(BAD_REQUEST).entity(unsupportedOperationException.getMessage()).build(); } Geolocation geolocation = createFrom(new Sid(accountSid), data, geolocationType); if (geolocation.getResponseStatus() != null && geolocation.getResponseStatus().equals(responseStatus.Rejected.toString())) { if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(geolocation); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(geolocation), APPLICATION_JSON).build(); } else { return null; } } else { dao.addGeolocation(geolocation); if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(geolocation); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(geolocation), APPLICATION_JSON).build(); } else { return null; } } }