Commit 527c553
## Problem
When a contentlet placed in a container on a page is **archived**, it
continues to render in the page's **Edit** and **Preview** modes (UVE).
It is correctly hidden in **Live** mode. Archived content should not
appear on a page in any mode.
A secondary symptom: while an archived contentlet remains in a
container, removing a different (non-archived) contentlet from the page
hangs ("spinning forever"). The browser POST to
`/api/v1/page/{id}/content` returns **400 "Can't find contentlet:
\<archived-id\>"**.
## Root cause
Archiving sets `deleted = true` on the version info but keeps the
working inode. In Edit/Preview `PageMode.showLive = false`, so
`PageRenderUtil.getSpecificContentlet()` resolves `find(workingInode)`
and returns the archived working version — and `populateContainers()`
only guarded against `null`. Live mode has no live version, so it was
already excluded.
Because the archived content kept rendering, it stayed in the editor's
page model. On save (a **full replacement**),
`PageResource.validateContainerEntries()` looked the id up via
`findContentletByIdentifierAnyLanguageAnyVariant()`, which filters out
deleted versions, found nothing, and threw `DotContentletStateException`
— a `RuntimeException` not caught by the method's `catch
(DotDataException)` — surfacing as HTTP 400 and hanging the remove.
## Changes
- **`PageRenderUtil.populateContainers()`** — skip
`contentlet.isArchived()` in all modes, consistent with Live-mode
behavior. (Also corrected a stray `DotStateException` import.)
- **`PageResource.validateContainerEntries()`** — skip archived content
instead of throwing the 400, so a page that still references archived
content remains saveable (the content gets removed on save).
- **`PageResourceTest`** — new self-validating integration test
`testArchivedContentNotRenderedInEditAndPreviewMode`: renders the page
**before** archiving (asserts the content shows, count == 1), archives,
then asserts count == 0 in PREVIEW and EDIT modes.
## Testing
- Bug reproduced on unfixed core: the new test **failed** `expected:<0>
but was:<1>`.
- With the fix: the test **passes**.
- Full `PageResourceTest` (31 tests) passes against the fixed core with
the build cache disabled.
## ⚠️ Reviewer note — intentional behavior change in page-save semantics
After this fix, archived content no longer renders on a page in any
mode. Because the page-save endpoint (`POST /api/v1/page/{id}/content`)
is a **full replacement** of each container's content, the next time a
user saves the page the archived content — no longer in the editor's
model — is **removed from the page's `multi_tree` association**.
**Implication:** if that content is later **unarchived**, it will
**not** automatically reappear on the page; it must be re-added
manually.
We consider this acceptable (archived content shouldn't be bound to live
pages), but flagging it explicitly. An alternative — preserving the
`multi_tree` association so unarchive restores placement — was
considered and rejected as more complex and less intuitive. **Please
confirm you're comfortable with the chosen semantics.**
Refs: #35993
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 390a561 commit 527c553
3 files changed
Lines changed: 174 additions & 12 deletions
File tree
- dotCMS/src/main/java/com/dotcms
- rendering/velocity/services
- rest/api/v1/page
- dotcms-integration/src/test/java/com/dotcms/rest/api/v1/page
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
299 | 319 | | |
300 | 320 | | |
301 | 321 | | |
| |||
Lines changed: 73 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
1033 | 1036 | | |
1034 | 1037 | | |
1035 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1036 | 1044 | | |
1037 | 1045 | | |
1038 | 1046 | | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1039 | 1052 | | |
1040 | 1053 | | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
1041 | 1061 | | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
1045 | 1072 | | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1046 | 1088 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1052 | 1094 | | |
1053 | | - | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1054 | 1102 | | |
1055 | 1103 | | |
1056 | 1104 | | |
| |||
1063 | 1111 | | |
1064 | 1112 | | |
1065 | 1113 | | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1069 | 1130 | | |
1070 | 1131 | | |
1071 | 1132 | | |
| |||
Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
749 | 749 | | |
750 | 750 | | |
751 | 751 | | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
752 | 833 | | |
753 | 834 | | |
754 | 835 | | |
| |||
0 commit comments