Portlet Edit mode throws NullPointer (GateIn 3.1)
g.nuijen Jun 25, 2010 9:14 AMHello,
I am trying to create a portlet with an edit mode, but I am running into some troubles. It is based on PortletBridge 2.0.0.FINAL + seam and facelets.
portlet.xml:
<portlet> <portlet-name>chartPortlet</portlet-name> <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class> <init-param> <name>javax.portlet.faces.defaultViewId.view</name> <value>/chart.xhtml</value> </init-param> <init-param> <name>javax.portlet.faces.defaultViewId.edit</name> <value>/chart_config.xhtml</value> </init-param> <init-param> <name>javax.portlet.faces.preserveActionParams</name> <value>true</value> </init-param> <init-param> <name>javax.portlet.faces.autoDispatchEvents</name> <value>true</value> </init-param> <expiration-cache>-0</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>EDIT</portlet-mode> </supports> <portlet-info> <title>Chart portlet</title> </portlet-info> <portlet-preferences> <preference> <name>chartXml</name> <value>/charts/chart1.xml</value> </preference> </portlet-preferences> </portlet>
/chart_config.xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<p>Simple message</p>
</f:view>
As you can see, there is nothing special in the page. It should just display a simple message.
Exception:
java.lang.NullPointerException
at java.lang.String.<init>(String.java:515)
at org.exoplatform.portal.webui.application.UIPortletForm.getEditModeContent(UIPortletForm.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
I traced it in the sourcecode to:
String content; if (portletResponse instanceof FragmentResponse) { FragmentResponse fragmentResponse = (FragmentResponse)portletResponse; content = new String(fragmentResponse.getBytes(), "UTF-8"); }
The result of getBytes() seems to be null.
What am I doing wrong?