Skip to content

Commit

Permalink
SAK-48471: Fix NPE in PortletIframe line 1360 (sakaiproject#11324)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuoY121 authored Mar 20, 2023
1 parent 77c5a9c commit 1888727
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/web-portlet/src/bundle/iframe.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ gen.trouble.loading = This page seems to have trouble loading.
new.page.launch = Page launched in a new window.
new.page.relaunch = Re-launch page in a new window.
dissmiss.page.relaunch.message = Click to dismiss

error.placement.isNull = Error: Placement is null.

Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ public void doView(RenderRequest request, RenderResponse response)
PrintWriter out = response.getWriter();
Context context = new VelocityContext();
Placement placement = ToolManager.getCurrentPlacement();

if (placement == null) {
out.println(rb.getString("error.placement.isNull"));
return;
}
Properties config = getAllProperties(placement);

response.setTitle(placement.getTitle());
Expand Down Expand Up @@ -548,6 +553,10 @@ public void doEdit(RenderRequest request, RenderResponse response)
context.put("doUpdate", "sakai.update");

Placement placement = ToolManager.getCurrentPlacement();
if (placement == null) {
out.println(rb.getString("error.placement.isNull"));
return;
}
Properties config = getAllProperties(placement);
String special = getSpecial(config);
context.put("title", formattedText.escapeHtml(placement.getTitle(), false));
Expand Down Expand Up @@ -761,6 +770,10 @@ public void processActionEdit(ActionRequest request, ActionResponse response)

// get the site toolConfiguration, if this is part of a site.
Placement placement = ToolManager.getCurrentPlacement();
if (placement == null) {
log.error(rb.getString("error.placement.isNull"));
return;
}
ToolConfiguration toolConfig = SiteService.findTool(placement.getId());
Properties config = getAllProperties(placement);
String special = getSpecial(config);
Expand Down

0 comments on commit 1888727

Please sign in to comment.