Source:
<code>public MetadataResponse sync(String entity, String system, String key, String... values) { MetadataResponse result = new MetadataResponse(); StringBuilder message = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); message.append("<SyncRequest><EntityName>"); message.append(entity); message.append("</EntityName><KeyName>"); message.append(key); message.append("</KeyName>"); for(String value: values) { if(value!=null && value.length()>0) { message.append("<KeyValue>"); message.append(value); message.append("</KeyValue>"); } } message.append("</SyncRequest>"); log.log(Level.INFO, "Initiating sync request:"+message.toString()); boolean foundActiveHost = false; for(String restEndPoint: resyncRestEndpoints) { try { URL url = new URL(restEndPoint); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/xml"); OutputStream os = conn.getOutputStream(); os.write(message.toString().getBytes()); os.flush(); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { foundActiveHost = true; break; } else { log.warning("unable to send resync message to:"+restEndPoint); } conn.disconnect(); } catch (MalformedURLException e) { result.setErrorMessage(e.getMessage()); } catch (IOException e) { result.setErrorMessage(e.getMessage()); } } <START> if(!foundActiveHost && result.getStatus()==MetadataResponse.Status.Success) { <END> result.setErrorMessage("Unable to resync message"); } return result; }</code><technical_language>I result is set updated is created, I this status check work, MetadataResponse returned this method initial (new MetadataResponse())</technical_language>

Target:
public MetadataResponse sync(String entity, String system, String key, String... values) { StringBuilder message = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); message.append("<SyncRequest><EntityName>"); message.append(entity); message.append("</EntityName><System>"); message.append(system); message.append("</System><KeyName>"); message.append(key); message.append("</KeyName>"); for(String value: values) { if(value!=null && value.length()>0) { message.append("<KeyValue>"); message.append(value); message.append("</KeyValue>"); } } message.append("</SyncRequest>"); log.log(Level.INFO, "Initiating sync request:"+message.toString()); boolean foundActiveHost = false; for(String restEndPoint: resyncRestEndpoints) { try { URL url = new URL(restEndPoint); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/xml"); OutputStream os = conn.getOutputStream(); os.write(message.toString().getBytes()); os.flush(); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { return new MetadataResponse(); } else { log.warning("unable to send resync message, recieved Http response code:"+ conn.getResponseCode()+ " response message:"+conn.getResponseMessage()+" from:"+restEndPoint); } conn.disconnect(); } catch (MalformedURLException e) { log.severe(e.getMessage()); } catch (IOException e) { log.severe(e.getMessage()); } } MetadataResponse result = new MetadataResponse(); result.setErrorMessage("Unable to resync message"); return result; }