DURACOM-267 improve handling of empty configuration property

(cherry picked from commit 0422b8786f)
This commit is contained in:
Andrea Bollini
2024-05-31 19:47:12 +02:00
committed by github-actions[bot]
parent 4b5248fe15
commit b9e6af6758

View File

@@ -41,13 +41,17 @@ public class DSpaceConfigurationPropertySource extends EnumerablePropertySource<
@Override @Override
public Object getProperty(final String name) { public Object getProperty(final String name) {
final String[] propValue = source.getStringArray(name); if (source.getProperty(name) != null) {
if (propValue == null || propValue.length == 0) { final String[] propValue = source.getStringArray(name);
return null; if (propValue == null || propValue.length == 0) {
} else if (propValue.length == 1) { return "";
return propValue[0]; } else if (propValue.length == 1) {
return propValue[0];
} else {
return propValue;
}
} else { } else {
return propValue; return null;
} }
} }