Source:
private List<String> getDefaultTextValue(FormField field) { String fieldId = field.getName(); Map<String, String> fieldAttributes = new HashMap<String, String>(); List<String> definedValues = new ArrayList<String>(); fieldAttributes.putAll(field.getFormControl().getAttributesMap()); fieldAttributes.put("Control Type", field.getFormControl().getFormControlType().name()); if (field.getFormControl().getFormControlType().isSubmit()) { List<String> submitFields = new ArrayList<String>(); for (String value : field.getPredefinedValues()) { String finalValue = this.valueGenerator.getValue( uri, url, fieldId, value, definedValues, envAttributes, fieldAttributes); submitFields.add(finalValue); } return submitFields; } List<String> values = field.getValues(); String defaultValue = null; if (field.getFormControl().getAttributesMap().containsKey("value")) { defaultValue = field.getFormControl().getAttributesMap().get("value"); } if (log.isDebugEnabled()) { log.debug("Existing values: " + values); } if (values.isEmpty() || (values.size() == 1 && values.get(0).isEmpty())) { Collection<String> predefValues = field.getPredefinedValues(); if (!predefValues.isEmpty()) { definedValues.addAll(predefValues); if (defaultValue == null) { Iterator<String> iterator = predefValues.iterator(); defaultValue = iterator.next(); if (iterator.hasNext()) { defaultValue = iterator.next(); } } } } else if (defaultValue == null) { defaultValue = values.get(0) == null ? DEFAULT_EMPTY_VALUE : values.get(0); } String finalValue = this.valueGenerator.getValue( uri, url, fieldId, defaultValue, definedValues, envAttributes, fieldAttributes); log.debug("Generated: " + finalValue + "For field " + field.getName()); values = new ArrayList<>(1); values.add(finalValue); return values; }

Target:
private List<String> getDefaultTextValue(FormField field) { String fieldId = field.getName(); Map<String, String> fieldAttributes = new HashMap<String, String>(); List<String> definedValues = new ArrayList<String>(); fieldAttributes.putAll(field.getFormControl().getAttributesMap()); fieldAttributes.put("Control Type", field.getFormControl().getFormControlType().name()); if (field.getFormControl().getFormControlType().isSubmit()) { List<String> submitFields = new ArrayList<String>(); for (String value : field.getPredefinedValues()) { String finalValue = this.valueGenerator.getValue( uri, url, fieldId, value, definedValues, envAttributes, fieldAttributes); submitFields.add(finalValue); } return submitFields; } List<String> values = field.getValues(); String defaultValue = null; if (field.getFormControl().getAttributesMap().containsKey("value")) { defaultValue = field.getFormControl().getAttributesMap().get("value"); } if (log.isDebugEnabled()) { log.debug("Existing values: " + values); } if (values.isEmpty() || (values.size() == 1 && values.get(0).isEmpty())) { Collection<String> predefValues = field.getPredefinedValues(); if (!predefValues.isEmpty()) { definedValues.addAll(predefValues); if (defaultValue == null) { Iterator<String> iterator = predefValues.iterator(); defaultValue = iterator.next(); if (iterator.hasNext()) { defaultValue = iterator.next(); } } } defaultValue = defaultValue == null ? DEFAULT_EMPTY_VALUE : defaultValue; } else if (defaultValue == null) { defaultValue = values.get(0); } String finalValue = this.valueGenerator.getValue( uri, url, fieldId, defaultValue, definedValues, envAttributes, fieldAttributes); log.debug("Generated: " + finalValue + "For field " + field.getName()); values = new ArrayList<>(1); values.add(finalValue); return values; }