Search the FirstSpirit Knowledge Base
Hello,
FirstSpirit 5.1.605.IE 9/Chrome 34.
I have been building a ReportPlugin, which lists Pages according to various criteria. The basic plugin is working in SiteArchitect, and the report appears in ContentCreator. But when I mouse over the Report item, or click on it, an error is thrown.
In the web browser console the error is:
On the server, the logs show:
[–] 11:46:54 DEBUG 01.08.2016 11:46:54.707 (fs.webedit.server.report.HtmlReportManager) [...] 01.08.2016 11:46:54 DEBUG 01.08.2016 11:46:54.707 (de.espirit.firstspirit.webedit.server.report.HtmlReportManager): Created report-proxy, handle=715816598, type=PluginReportType{_type=uk.gov.scotland.afrc.firstspirit.contentreports.PageContentReportPlugin,renderer:false}, sessionID=3601705410209406750, user=d416936
Then:
(de.espirit.firstspirit.webedit.server.control.PollSupportingWebeditService): [Sync] call 'HtmlReportServiceImpl.getActions()' failed: java.lang.NullPointerException
FSVersion=5.1.605.72781#4210;JDK=1.7.0_45 64bit Oracle Corporation;OS=Linux 2.6.32-358.23.2.el6.x86_64 amd64;Date=01.08.2016 11:46:57
java.lang.NullPointerException
at de.espirit.firstspirit.webedit.server.action.ActionManager.getPluginActions(ActionManager.java:273)...
Then:
1.08.2016 11:46:57 WARN 01.08.2016 11:46:57.444 (/fs5webedit_466725): Exception while dispatching incoming RPC call
FSVersion=5.1.605.72781#4210;JDK=1.7.0_45 64bit Oracle Corporation;OS=Linux 2.6.32-358.23.2.el6.x86_64 amd64;Date=01.08.2016 11:46:57
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract de.espirit.firstspirit.webedit.client.action.Action[] de.espirit.firstspirit.webedit.client.report.HtmlReportService.getActions(int,java.lang.String) throws de.espirit.firstspirit.webedit.client.report.ReportException' threw an unexpected exception: java.lang.NullPointerException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at de.espirit.firstspirit.webedit.server.control.PollSupportingWebeditService.logAndEncode...
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
at de.espirit.firstspirit.webedit.server.action.ActionManager.getPluginActions(ActionManager.java:273)
at de.espirit.firstspirit.webedit.server.action.ActionManager._getActions(ActionManager.java:178)
I can't find any reference to HtmlReportManager or HtmlReportService in the FirstSpirit documentation, so I don't know what I've done wrong or forgotten to do.
My ReportItem looks like this code. The logging message "Navigating to..." never appears in the logs:
public class AFRCReportItem extends ReportType implements ReportItem<IDProvider>, JavaClientExecutableReportItem<IDProvider>,
WebeditExecutableReportItem<IDProvider> {
...
public void execute(ReportContext<IDProvider> reportContext) {
final IDProvider idProvider = reportContext.getObject();
reportContext.logDebug("++++ Navigating to " + idProvider.getUid() + ", class: " + idProvider.getClass().getName());
if (!reportContext.is(BaseContext.Env.WEBEDIT)) {
reportContext.requireSpecialist(OperationAgent.TYPE).getOperation(DisplayElementOperation.TYPE).perform(idProvider);
} else {
PageRef pageRef = null;
for (final ReferenceEntry inboundReference : idProvider.getIncomingReferences()) {
if (inboundReference.getType() == ReferenceEntry.SITE_STORE_REFERENCE) {
final IDProvider referenceElement = inboundReference.getReferencedElement();
if (referenceElement instanceof PageRef && idProvider.equals(((PageRef) referenceElement).getPage())) {
pageRef = (PageRef) referenceElement;
}
}
}
if (pageRef != null) {
final OperationAgent operationAgent = reportContext.requestSpecialist(OperationAgent.TYPE);
final DisplayElementOperation displayElementOperation = operationAgent.getOperation(DisplayElementOperation.TYPE);
if (displayElementOperation != null) {
displayElementOperation.setLanguage(reportContext.getObject().getProject().getMasterLanguage());
reportContext.logDebug("++++ Navigating to " + pageRef.getUid() + "");
displayElementOperation.perform(pageRef);
}
}
}
}
The report only lists Pages, and when the user clicks on the page the ContentCreator should navigate to that page, as it does in SiteArchitect.
Many thanks,
Liam Davison
Hi Liam,
as the error already appears when you hover, it's not in the item's execute method.
Possible places to look for the NPE's origin are in the getItems() method of the plugin itself (would be my first guess) or in the "UI methods" of the item (getIconPath, isEnabled, isVisible etc.).
Michael
Hi Liam,
with "when I mouse over the Report item" you refer to a result snippet in the report, correct? So the report's search itself is working and you get results - and the error occurs when trying to interact with the snippets?
Michael
Hi Michael,
Yes, exactly that. The report search is working, but I can't interact with the snippets in the report.
Liam
Hi Liam,
as the error already appears when you hover, it's not in the item's execute method.
Possible places to look for the NPE's origin are in the getItems() method of the plugin itself (would be my first guess) or in the "UI methods" of the item (getIconPath, isEnabled, isVisible etc.).
Michael