Skip to content

Commit e535254

Browse files
committed
fix : When exporting a page template containing SpaceList portlet, there is an error in server logs - MEED-10036 - Meeds-io/meeds#3910
When exporting this template, the generatePreferences function do not check if preferences object is null. This commit ensure to return an emptyList in this case Resolves Meeds-io/meeds#3910
1 parent 2b6c24e commit e535254

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

layout-service/src/main/java/io/meeds/layout/plugin/renderer/SpaceDirectoryPortletInstancePreferencePlugin.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
package io.meeds.layout.plugin.renderer;
2121

22+
import java.util.Collections;
2223
import java.util.List;
2324
import java.util.stream.StreamSupport;
2425

@@ -47,13 +48,17 @@ public String getPortletName() {
4748
@Override
4849
@SneakyThrows
4950
public List<PortletInstancePreference> generatePreferences(Application application, Portlet preferences, PortletInstanceContext portletInstanceContext) {
51+
if (preferences == null) {
52+
return Collections.emptyList();
53+
}
5054
return StreamSupport.stream(preferences.spliterator(), false)
51-
// remove generated setting name for the original
52-
// instance to avoid duplicating instances using the
53-
// same setting name
54-
.filter(p -> !StringUtils.equals(SETTING_PREFERENCE_NAME, p.getName()))
55-
.map(p -> new PortletInstancePreference(p.getName(), p.getValue()))
56-
.toList();
55+
// remove generated setting name for the original
56+
// instance to avoid duplicating instances using the
57+
// same setting name
58+
.filter(p -> !StringUtils.equals(SETTING_PREFERENCE_NAME, p.getName()))
59+
.map(p -> new PortletInstancePreference(p.getName(), p.getValue()))
60+
.toList();
61+
5762
}
5863

5964
}

0 commit comments

Comments
 (0)