Processing properties and property descriptors in Controller Service referencing components unconditionally.
This closes
@@ -1502,9 +1502,12 @@ public final class DtoFactory {
processGroupId = null;
}
- dto.setDescriptors(new LinkedHashMap<String, PropertyDescriptorDTO>());
- dto.setProperties(new LinkedHashMap<String, String>());
- if (propertyDescriptors != null && !propertyDescriptors.isEmpty()) {
+ // ensure descriptors is non null
+ if (propertyDescriptors == null) {
+ propertyDescriptors = new ArrayList<>();
+ }
+
+ // process properties unconditionally since dynamic properties are available here and not in getPropertyDescriptors
final Map<PropertyDescriptor, String> sortedProperties = new TreeMap<>(new Comparator<PropertyDescriptor>() {
@Override
public int compare(final PropertyDescriptor o1, final PropertyDescriptor o2) {
@@ -1520,6 +1523,8 @@ public final class DtoFactory {
orderedProperties.putAll(sortedProperties);
// build the descriptor and property dtos
+ dto.setDescriptors(new LinkedHashMap<String, PropertyDescriptorDTO>());
+ dto.setProperties(new LinkedHashMap<String, String>());
for (final Map.Entry<PropertyDescriptor, String> entry : orderedProperties.entrySet()) {
final PropertyDescriptor descriptor = entry.getKey();
@@ -1535,7 +1540,6 @@ public final class DtoFactory {
// set the property value
dto.getProperties().put(descriptor.getName(), propertyValue);
}
- }
if (validationErrors != null && !validationErrors.isEmpty()) {
final List<String> errors = new ArrayList<>();
