brightspot-cms icon indicating copy to clipboard operation
brightspot-cms copied to clipboard

Accidental StackOverflowError in Dashboard

Open Typografikon opened this issue 5 years ago • 0 comments

I got accidental StackOverflowError in BrightspotCMS Dashboard when adding item to list of @Embedded items and saving entity. There is no error when adding item to list programatically and saving with com.psddev.dari.db.Record.save()

Code excerpt:

import java.util.*;
import com.psddev.cms.db.*;
import com.psddev.dari.db.Recordable.*;
import com.psddev.cms.db.ToolUi.*

public class Navigation extends Content {

	@Indexed
	@Sortable
	protected List<NavigationItem> servedEntities = new ArrayList<>();

	public List<NavigationItem> getServedEntities() {
		return servedEntities;
	}
}

@Embedded
public class NavigationItem extends Content {

	@Indexed
	@Sortable
	protected List<NavigationItem> menuEntities = new ArrayList<>();

	public List<NavigationItem> getMenuEntities() {
		return menuEntities;
	}
}

Error in Dashboard:

    java.lang.StackOverflowError: 
    javax.servlet.ServletException: Filter execution threw an exception
    java.lang.RuntimeException: javax.servlet.ServletException: Filter execution threw an exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page [/cms/WEB-INF/objectPost.jsp] at line [72]

    69:                     includeFields.contains(name)) &&
    70:                     (excludeFields == null ||
    71:                     !excludeFields.contains(name))) {
    72:                 wp.processField(object, field);
    73:             }
    74:         }
    75: 


    Stacktrace:
    org.apache.jasper.JasperException: An exception occurred processing JSP page [/cms/WEB-INF/field/list/record.jsp] at line [126]

    123:                 itemState.putAll((Map<String, Object>) ObjectUtils.fromJson(data));
    124: 
    125:             } else {
    126:                 wp.updateUsingParameters(item);
    127:             }
    128: 
    129:             itemState.remove(Content.PUBLISH_DATE_FIELD);

This works without any problem:

NavigationItem i = new NavigationItem();
Navigation n =  Query.from(Navigation.class).first();
n.getServedEntities().get(0).getMenuEntities().add(i);
n.save()

Did anybody noticed also this error? I am using brightspot-parent 3.3.30.3 (dari 3.3.349-fdedf5 and cms-db 3.3.1131-88140b).

Typografikon avatar Nov 23 '19 00:11 Typografikon