Source:
public Response updateInstanceConfig(@PathParam("clusterId") String clusterId, @PathParam("instanceName") String instanceName, @QueryParam("command") String commandStr, String content) { Command command; if (commandStr == null || commandStr.isEmpty()) { command = Command.update; } else { try { command = getCommand(commandStr); } catch (HelixException ex) { return badRequest(ex.getMessage()); } } ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { LOG.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } InstanceConfig instanceConfig = new InstanceConfig(record); ConfigAccessor configAccessor = getConfigAccessor(); try { if (command == Command.delete || command == Command.update) { validateDeltaTopologySettingInInstanceConfig(clusterId, instanceName, configAccessor, instanceConfig, command == Command.delete); } switch (command) { case update: configAccessor.updateInstanceConfig(clusterId, instanceName, instanceConfig); break; case delete: HelixConfigScope instanceScope = new HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.PARTICIPANT) .forCluster(clusterId).forParticipant(instanceName).build(); configAccessor.remove(instanceScope, record); break; default: return badRequest(String.format("Unsupported command: %s", command)); } } catch (IllegalArgumentException ex) { LOG.error(String.format("Invalid topology setting for Instance : %s. Fail the config update", instanceName), ex); return serverError(ex); } catch (HelixException ex) { return notFound(ex.getMessage()); } catch (Exception ex) { LOG.error(String.format("Error in update instance config for instance: %s", instanceName), ex); return serverError(ex); } return OK(); }

Target:
public Response updateInstanceConfig(@PathParam("clusterId") String clusterId, @PathParam("instanceName") String instanceName, @QueryParam("command") String commandStr, String content) { Command command; if (commandStr == null || commandStr.isEmpty()) { command = Command.update; } else { try { command = getCommand(commandStr); } catch (HelixException ex) { return badRequest(ex.getMessage()); } } ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { LOG.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } InstanceConfig instanceConfig = new InstanceConfig(record); ConfigAccessor configAccessor = getConfigAccessor(); try { switch (command) { case update: validateDeltaTopologySettingInInstanceConfig(clusterId, instanceName, configAccessor, instanceConfig, command); configAccessor.updateInstanceConfig(clusterId, instanceName, instanceConfig); break; case delete: validateDeltaTopologySettingInInstanceConfig(clusterId, instanceName, configAccessor, instanceConfig, command); HelixConfigScope instanceScope = new HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.PARTICIPANT) .forCluster(clusterId).forParticipant(instanceName).build(); configAccessor.remove(instanceScope, record); break; default: return badRequest(String.format("Unsupported command: %s", command)); } } catch (IllegalArgumentException ex) { LOG.error(String.format("Invalid topology setting for Instance : {}. Fail the config update", instanceName), ex); return serverError(ex); } catch (HelixException ex) { return notFound(ex.getMessage()); } catch (Exception ex) { LOG.error(String.format("Error in update instance config for instance: %s", instanceName), ex); return serverError(ex); } return OK(); }