Source:
private void updateExistingAndNewOptions(GlusterVolumeEntity existingVolume, Collection<GlusterVolumeOptionEntity> fetchedOptions) { for (GlusterVolumeOptionEntity fetchedOption : fetchedOptions) { GlusterVolumeOptionEntity existingOption = existingVolume.getOption(fetchedOption.getKey()); if (existingOption == null) { logAuditMessage(existingVolume.getClusterId(), existingVolume, null, AuditLogType.GLUSTER_VOLUME_OPTION_SET_FROM_CLI, ENTITY_OPTION, fetchedOption.toString()); log.infoFormat("New option {0}={1} set on volume {2} from gluster CLI. Updating engine DB accordingly.", fetchedOption.getKey(), fetchedOption.getValue(), existingVolume.getName()); try { getOptionDao().save(fetchedOption); } catch (Exception e) { log.errorFormat("Could not save option {0} of volume {1) to database!", fetchedOption, existingVolume.getName(), e); } } else if (!existingOption.getValue().equals(fetchedOption.getValue())) { logAuditMessage(existingVolume.getClusterId(), existingVolume, null, AuditLogType.GLUSTER_VOLUME_OPTION_CHANGED_FROM_CLI, ENTITY_OPTION, fetchedOption.toString()); log.infoFormat("Value of option {0} of volume {1} changed from {2} to {3} from CLI. Updating engine DB accordingly.", existingOption.getKey(), existingVolume.getName(), existingOption.getValue(), fetchedOption.getValue()); try { getOptionDao().updateVolumeOption(existingOption.getId(), fetchedOption.getValue()); } catch (Exception e) { log.errorFormat("Error while updating option {0} of volume {1} in database!", fetchedOption, existingVolume.getName(), e); } } } }

Target:
private void updateExistingAndNewOptions(GlusterVolumeEntity existingVolume, Collection<GlusterVolumeOptionEntity> fetchedOptions) { for (GlusterVolumeOptionEntity fetchedOption : fetchedOptions) { GlusterVolumeOptionEntity existingOption = existingVolume.getOption(fetchedOption.getKey()); if (existingOption == null) { logDirector.logAuditMessage(existingVolume.getClusterId(), existingVolume, null, AuditLogType.GLUSTER_VOLUME_OPTION_SET_FROM_CLI, new String[] { GlusterConstants.OPTION_KEY, fetchedOption.getKey() }, new String[] { GlusterConstants.OPTION_VALUE, fetchedOption.getValue() }); log.infoFormat("New option {0}={1} set on volume {2} from gluster CLI. Updating engine DB accordingly.", fetchedOption.getKey(), fetchedOption.getValue(), existingVolume.getName()); try { getOptionDao().save(fetchedOption); } catch (Exception e) { log.errorFormat("Could not save option {0} of volume {1) to database!", fetchedOption, existingVolume.getName(), e); } } else if (!existingOption.getValue().equals(fetchedOption.getValue())) { logDirector.logAuditMessage(existingVolume.getClusterId(), existingVolume, null, AuditLogType.GLUSTER_VOLUME_OPTION_CHANGED_FROM_CLI, new String[] { GlusterConstants.OPTION_KEY, existingOption.getKey() }, new String[] { GlusterConstants.OPTION_OLD_VALUE, existingOption.getValue() }, new String[] { GlusterConstants.OPTION_NEW_VALUE, fetchedOption.getValue() }); log.infoFormat("Detected change in value of option {0} of volume {1} from {2} to {3}. Updating engine DB accordingly.", existingOption.getKey(), existingVolume.getName(), existingOption.getValue(), fetchedOption.getValue()); try { getOptionDao().updateVolumeOption(existingOption.getId(), fetchedOption.getValue()); } catch (Exception e) { log.errorFormat("Error while updating option {0} of volume {1} in database!", fetchedOption, existingVolume.getName(), e); } } } }