-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 12.2.5, 12.3
-
Fix Version/s: 12.3.2
-
Component/s: Repository, Catalog, Learning resources
-
Labels:None
-
Funded by:
After doing the following steps a sleeping lion occurs:
- Create a new course
- Choose an execution period and save it
- Edit directly the access configuration and save it
- Run the new course by clicking the root element in breadcrumb
- Navigate directly to "Course Info"
- The following exception occurs:
org.olat.core.logging.OLATRuntimeException: exception occured while
merging template: Reference evaluation threw an exception at
org/olat/repository/ui/list/_content/details.html[line 48, column 45] -> at
org.olat.core.gui.render.velocity.VelocityHelper.merge(VelocityHelper.java:164)
The cause is that the repository entry object is read from database by calling RepositoryEntryDAO.loadForUpdate(). In this case a lifecycle object is instantiated but with no values set. Changing the method to RepositoryEntryDAO.loadByKey() fixes that. Here's the patch:
diff --git a/src/main/java/org/olat/repository/RepositoryManager.java b/src/main/java/org/olat/repository/RepositoryManager.java --- a/src/main/java/org/olat/repository/RepositoryManager.java +++ b/src/main/java/org/olat/repository/RepositoryManager.java @@ -676,7 +676,7 @@ public RepositoryEntry setAccessAndProperties(final RepositoryEntry re, int access, boolean membersOnly, boolean canCopy, boolean canReference, boolean canDownload) { - RepositoryEntry reloadedRe = repositoryEntryDao.loadForUpdate(re); + RepositoryEntry reloadedRe = repositoryEntryDao.loadByKey(re.getKey()); if(reloadedRe == null) { return null; } @@ -702,7 +702,7 @@ public RepositoryEntry setLeaveSetting(final RepositoryEntry re, RepositoryEntryAllowToLeaveOptions setting) { - RepositoryEntry reloadedRe = repositoryEntryDao.loadForUpdate(re); + RepositoryEntry reloadedRe = repositoryEntryDao.loadByKey(re.getKey()); if(reloadedRe == null) { return null; }