private void validateMessage(String expectedType,String type,long returnCode,String service,String payload) throws ReplicatorException {
  if (!type.equals(expectedType)) {
    throw new ReplicatorException("Server should have returned message of type \"" + Protocol.TYPE_FILTERED + "\", but returned \""+ type+ "\" instead");
  }
 else   if (returnCode != 0) {
    throw new ReplicatorException("Server returned a non-zero code (" + returnCode + "), payload: "+ payload);
  }
 else   if (!service.equals(messageGenerator.getService())) {
    throw new ReplicatorException("Server returned unexpected service name in the message: received \"" + service + "\", but expected \""+ messageGenerator.getService()+ "\"");
  }
}

private void validateMessage ( String expectedType , String type , long returnCode , String service , String payload ) throws ReplicatorException { if ( ! type . equals ( expectedType ) ) { throw new ReplicatorException ( "Server should have returned message of type \"" + Protocol . TYPE_FILTERED + "\", but returned \"" + type + "\" instead" ) ; } else if ( returnCode != 0 ) { throw new ReplicatorException ( "Server returned a non-zero code (" + returnCode + "), payload: " + payload ) ; } else if ( ! service . equals ( messageGenerator . getService ( ) ) ) { throw new ReplicatorException ( "Server returned unexpected service name in the message: received \"" + service + "\", but expected \"" + messageGenerator . getService ( ) + "\"" ) ; } }
protocol safety checks for the server returned message .
