AnsweredAssumed Answered

NPE when writing rich text content

Question asked by philcms1 on Mar 26, 2009
Hi everybody,

I am trying to put together a proof of concept to use Alfresco. I am using a Grail web app to create content using the web services API. Here is the relevant portion of the code:

ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
ContentFormat contentFormat = new ContentFormat("text/plain", "UTF-8");
String docText = "Test test…";
Content docContentRef = contentService.write(docRef, Constants.PROP_CONTENT, docText.getBytes(), contentFormat);
System.out.println("Content Length: " + docContentRef.getLength());

It works fine with "plain/text". Now I get from Grails a string containing rich text, and this gives me a NullPointerException when doing the write (although the document is created, there is no content associated with it). I tried putting "application/rtf", but still get an NPE. Any idea?

Thanks and best regards,