[PAGES-1123] Page template without dialog throws exception Created: 07/Apr/23  Updated: 03/Jul/23  Resolved: 29/Jun/23

Status: Closed
Project: Magnolia pages module
Component/s: Pages app
Affects Version/s: 6.2.26
Fix Version/s: 6.3, 6.2.29

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Antonín Juran
Resolution: Fixed Votes: 0
Labels: Nucleus_AuthX_Support
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 3h Time Spent: 3h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by PAGES-854 On page creation the prototype concep... Closed
Relates
relates to PAGES-932 siteSpa with prototype does not pick ... Open
relation
Sub-Tasks:
Key
Summary
Type
Status
Assignee
PAGES-1124 Implementation Sub-task Completed Antonín Juran  
PAGES-1125 Review Sub-task Completed Adam Siska  
PAGES-1126 Pre-Integration QA Sub-task Completed Adam Siska  
PAGES-1127 QA Sub-task Completed Quach Hao Thien  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Date of First Response:
Epic Link: AuthorX Support
Sprint: Nucleus 39
Story Points: 1
Team: AuthorX
Work Started:
Approved:
Yes

 Description   

When a page template doesn't have a configured dialog the pages app throws the following exception.

2023-04-07 07:10:08,550 ERROR nolia.ui.contentapp.browser.ActionExecutionService: An error occurred while executing action [commit]
info.magnolia.ui.api.action.ActionExecutionException: Action execution failed for action: commit
	at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:64) ~[magnolia-ui-api-6.2.32.jar:?]
	at info.magnolia.ui.contentapp.browser.ActionExecutionService.executeAction(ActionExecutionService.java:70) ~[magnolia-ui-framework-6.2.32.jar:?]
        ...
	...
Caused by: com.machinezoo.noexception.WrappedException: info.magnolia.ui.api.action.ActionExecutionException: Action execution failed for action: editProperties
	at com.machinezoo.noexception.WrappingHandler.handle(WrappingHandler.java:12) ~[noexception-1.6.2.jar:?]
        ...
	...
Caused by: info.magnolia.ui.api.action.ActionExecutionException: Action execution failed for action: editProperties
	at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:64) ~[magnolia-ui-api-6.2.32.jar:?]
	at info.magnolia.ui.contentapp.action.ChainedAction.execute(ChainedAction.java:80) ~[magnolia-ui-framework-6.2.32.jar:?]
        ...
	...
Caused by: java.lang.ClassCastException: info.magnolia.module.site.templates.ConfiguredTemplateSettings cannot be cast to info.magnolia.module.site.templates.ReferencingPrototypeTemplateSettings
	at info.magnolia.pages.app.action.browser.EditPagePropertiesAction.lambda$getDialogFromPrototypeTemplate$2(EditPagePropertiesAction.java:151) ~[magnolia-pages-app-6.2.26.jar:?]
	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_261]
	at info.magnolia.pages.app.action.browser.EditPagePropertiesAction.getDialogFromPrototypeTemplate(EditPagePropertiesAction.java:151) ~[magnolia-pages-app-6.2.26.jar:?]
	at info.magnolia.pages.app.action.browser.EditPagePropertiesAction.lambda$getDialogId$1(EditPagePropertiesAction.java:136) ~[magnolia-pages-app-6.2.26.jar:?]
	at java.util.Optional.orElseGet(Optional.java:267) ~[?:1.8.0_261]
	at info.magnolia.pages.app.action.browser.EditPagePropertiesAction.getDialogId(EditPagePropertiesAction.java:136) ~[magnolia-pages-app-6.2.26.jar:?]
	at info.magnolia.pages.app.action.browser.EditPagePropertiesAction.lambda$getDialogDefinition$0(EditPagePropertiesAction.java:124) ~[magnolia-pages-app-6.2.26.jar:?]
	at com.machinezoo.noexception.CheckedExceptionHandler.get(CheckedExceptionHandler.java:1835) ~[noexception-1.6.2.jar:?]
	at info.magnolia.pages.app.action.browser.EditPagePropertiesAction.getDialogDefinition(EditPagePropertiesAction.java:119) ~[magnolia-pages-app-6.2.26.jar:?]
	at info.magnolia.ui.dialog.actions.OpenDialogAction.execute(OpenDialogAction.java:96) ~[magnolia-ui-framework-6.2.32.jar:?]
	at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ~[magnolia-ui-api-6.2.32.jar:?]
	at info.magnolia.ui.contentapp.action.ChainedAction.execute(ChainedAction.java:80) ~[magnolia-ui-framework-6.2.32.jar:?]
	at info.magnolia.ui.contentapp.action.ChainedAction.lambda$execute$1(ChainedAction.java:76) ~[magnolia-ui-framework-6.2.32.jar:?]
	at com.machinezoo.noexception.CheckedExceptionHandler$CheckedConsumer.accept(CheckedExceptionHandler.java:319) ~[noexception-1.6.2.jar:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:1.8.0_261]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_261]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_261]
	at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_261]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_261]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_261]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_261]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_261]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_261]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_261]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_261]
	at info.magnolia.ui.contentapp.action.ChainedAction.execute(ChainedAction.java:76) ~[magnolia-ui-framework-6.2.32.jar:?]
	at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ~[magnolia-ui-api-6.2.32.jar:?]
	... 115 more

Reproduce

  • Install magnolia without the travel demo.
  • Find the page template /mtk2/templates/pages/basic.yaml
  • Edit the template and comment out the dialog
  • Try to use the template in the Pages app.

Expected
I can use a page template which doesn't have a configured dialog without any exceptions.

Actual
The Pages app throws a commit error.

Notes
It's related to the site definition. We made changes with PAGES-854 which exposed this. When you have a site definition that doesn't use ReferencingPrototypeTemplateSettings. So any older project which uses the more traditional approach could hit this issue. It is a bit of a niche, corner case, problem.



 Comments   
Comment by Robert Spatt [ 05/Jun/23 ]

Any updates on when this will be fixed?

Cheers,
Robert

Comment by Antonín Juran [ 12/Jun/23 ]

DISCOVERY

If there is not configured a dialog for a page template EditPagePropertiesAction#getDialogId gets the dialog from a prototype template where TemplateSetting is casted to ReferencingPrototypeTemplateSettings.
To avoid the ClassCastException there could be filtered instance of ReferencingPrototypeTemplateSettings in the EditPagePropertiesAction#getDialogFromPrototypeTemplate method.

 

Generated at Mon Feb 12 06:25:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.