From 9224aae2a6bd4a5e613ef3b275505be987b337e2 Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Fri, 27 Nov 2015 08:50:34 +0100
Subject: [PATCH] OO-1803	: show a warning if the resource has been
 deleted

---
 .../ui/author/AuthorListController.java       | 27 +++++++++++--------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/olat/repository/ui/author/AuthorListController.java b/src/main/java/org/olat/repository/ui/author/AuthorListController.java
index 392d4d576df..6df31e34771 100644
--- a/src/main/java/org/olat/repository/ui/author/AuthorListController.java
+++ b/src/main/java/org/olat/repository/ui/author/AuthorListController.java
@@ -560,13 +560,19 @@ public class AuthorListController extends FormBasicController implements Activat
 		removeAsListenerAndDispose(toolsCtrl);
 		removeAsListenerAndDispose(toolsCalloutCtrl);
 
-		toolsCtrl = new ToolsController(ureq, getWindowControl(), row);
-		listenTo(toolsCtrl);
-
-		toolsCalloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(),
-				toolsCtrl.getInitialComponent(), link.getFormDispatchId(), "", true, "");
-		listenTo(toolsCalloutCtrl);
-		toolsCalloutCtrl.activate();
+		RepositoryEntry entry = repositoryService.loadByKey(row.getKey());
+		if(entry == null) {
+			tableEl.reloadData();
+			showWarning("repositoryentry.not.existing");
+		} else {
+			toolsCtrl = new ToolsController(ureq, getWindowControl(), row, entry);
+			listenTo(toolsCtrl);
+	
+			toolsCalloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(),
+					toolsCtrl.getInitialComponent(), link.getFormDispatchId(), "", true, "");
+			listenTo(toolsCalloutCtrl);
+			toolsCalloutCtrl.activate();
+		}
 	}
 	
 	private void doImport(UserRequest ureq) {
@@ -919,19 +925,18 @@ public class AuthorListController extends FormBasicController implements Activat
 	private class ToolsController extends BasicController {
 		
 		private final AuthoringEntryRow row;
-		private final RepositoryEntry entry;
+
 		private final VelocityContainer mainVC;
 		
 		private boolean isOwner;
 		private boolean isOlatAdmin;
 		private boolean isAuthor;
 		
-		public ToolsController(UserRequest ureq, WindowControl wControl, AuthoringEntryRow row) {
+		public ToolsController(UserRequest ureq, WindowControl wControl, AuthoringEntryRow row, RepositoryEntry entry) {
 			super(ureq, wControl);
 			setTranslator(AuthorListController.this.getTranslator());
 			this.row = row;
-			this.entry = repositoryService.loadByKey(row.getKey());
-
+			
 			Identity identity = getIdentity();
 			Roles roles = ureq.getUserSession().getRoles();
 			isOlatAdmin = roles.isOLATAdmin();
-- 
GitLab