Source:
<code>public String formatRequest(Position position) throws UnsupportedEncodingException, JsonProcessingException { Device device = Context.getIdentityManager().getById(position.getDeviceId()); String request = url .replace("{name}", URLEncoder.encode(device.getName(), StandardCharsets.UTF_8.name())) .replace("{uniqueId}", device.getUniqueId()) .replace("{status}", device.getStatus()) .replace("{deviceId}", String.valueOf(position.getDeviceId())) .replace("{protocol}", String.valueOf(position.getProtocol())) <START> .replace("{deviceTime}", String.valueOf(position.getDeviceTime().getTime())) <END> .replace("{fixTime}", String.valueOf(position.getFixTime().getTime())) .replace("{valid}", String.valueOf(position.getValid())) .replace("{latitude}", String.valueOf(position.getLatitude())) .replace("{longitude}", String.valueOf(position.getLongitude())) .replace("{altitude}", (position.getAltitude() == null) ? "0" : String.valueOf(position.getAltitude())) .replace("{speed}", (position.getSpeed() == null) ? "0" : String.valueOf(position.getSpeed())) .replace("{course}", (position.getCourse() == null) ? "0" : String.valueOf(position.getCourse())) .replace("{accuracy}", (position.getAccuracy() == null) ? "0" : String.valueOf(position.getAccuracy())) .replace("{statusCode}", calculateStatus(position)); if (position.getAddress() != null) { request = request.replace( "{address}", URLEncoder.encode(position.getAddress(), StandardCharsets.UTF_8.name())); } if (request.contains("{attributes}")) { String attributes = Context.getObjectMapper().writeValueAsString(position.getAttributes()); request = request.replace( "{attributes}", URLEncoder.encode(attributes, StandardCharsets.UTF_8.name())); } if (request.contains("{gprmc}")) { request = request.replace("{gprmc}", formatSentence(position)); } return request; }</code><technical_language>this substitutions zero obligatory for protocol? empty string? do know</technical_language>

Target:
public String formatRequest(Position position) throws UnsupportedEncodingException, JsonProcessingException { Device device = Context.getIdentityManager().getById(position.getDeviceId()); String request = url .replace("{name}", URLEncoder.encode(device.getName(), StandardCharsets.UTF_8.name())) .replace("{uniqueId}", device.getUniqueId()) .replace("{status}", device.getStatus()) .replace("{deviceId}", String.valueOf(position.getDeviceId())) .replace("{protocol}", String.valueOf(position.getProtocol())) .replace("{deviceTime}", String.valueOf(position.getDeviceTime().getTime())) .replace("{fixTime}", String.valueOf(position.getFixTime().getTime())) .replace("{valid}", String.valueOf(position.getValid())) .replace("{latitude}", String.valueOf(position.getLatitude())) .replace("{longitude}", String.valueOf(position.getLongitude())) .replace("{altitude}", (position.getAltitude() == null) ? "0" : String.valueOf(position.getAltitude())) .replace("{speed}", String.valueOf(position.getSpeed())) .replace("{course}", (position.getCourse() == null) ? "0" : String.valueOf(position.getCourse())) .replace("{accuracy}", (position.getAccuracy() == null) ? "0" : String.valueOf(position.getAccuracy())) .replace("{statusCode}", calculateStatus(position)); if (position.getAddress() != null) { request = request.replace( "{address}", URLEncoder.encode(position.getAddress(), StandardCharsets.UTF_8.name())); } if (request.contains("{attributes}")) { String attributes = Context.getObjectMapper().writeValueAsString(position.getAttributes()); request = request.replace( "{attributes}", URLEncoder.encode(attributes, StandardCharsets.UTF_8.name())); } if (request.contains("{gprmc}")) { request = request.replace("{gprmc}", formatSentence(position)); } return request; }