Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
sri p
message boards message display
1 novembre 2013 11:21
Réponse

sri p

Rang: Junior Member

Publications: 81

Date d'inscription: 22 janvier 2011

Publications Récentes

Hello All,

I am using portal service util classes to create category and messages in liferay.
The message body is saving as follows in liferay database with quotes "<div><b>this is bold text</b><i>this text is in italics</i></div>" . (message format I set as: html ).
I am retrieving the content in custom action class and displaying it in a JSP page.

Now above message body text <div><b>this is bold text</b><i>this text is in italics</i></div>, coming as raw HTML code rather than rendering it as html.

Any help, please!

I am not sure, is there any liferay parser class that I need to use to render saved html text properly in JSP.

Thank you,
Sri
Zsigmond Rab
RE: message boards message display
3 novembre 2013 09:39
Réponse

Zsigmond Rab

LIFERAY STAFF

Rang: Liferay Master

Publications: 644

Date d'inscription: 4 janvier 2010

Publications Récentes

Hi Sri,

which version of the Liferay do you use?

Regards,
Zsigmond
sri p
RE: message boards message display
4 novembre 2013 14:44
Réponse

sri p

Rang: Junior Member

Publications: 81

Date d'inscription: 22 janvier 2011

Publications Récentes

&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;


saving above empty html into mbMessage throwing following error (liferay 6.1.1 ee version)


ERROR [http-/127.0.0.1:8180-5][HtmlBBCodeTranslatorImpl:108] Unable to parse: <html>
20:13:33,894 INFO (http-/127.0.0.1:8180-5) <head>
20:13:33,894 INFO (http-/127.0.0.1:8180-5) </head>
20:13:33,895 INFO (http-/127.0.0.1:8180-5) <body>
20:13:33,895 INFO (http-/127.0.0.1:8180-5) </body>
20:13:33,895 INFO (http-/127.0.0.1:8180-5) </html>

Parsing is failing due to "\n" characters in the HTML code. Failing In HtmlBBCodeTraslatorImpl.java at line 443 else if (data.matches("(?s).*\r?\n\\z")) {
bbCodeItem = bbCodeItems.get(marker.getValue() + 1);
...

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

20:13:33,756 INFO (http-/127.0.0.1:8180-5) at java.util.ArrayList.RangeCheck(ArrayList.java:547)

20:13:33,756 INFO (http-/127.0.0.1:8180-5) at java.util.ArrayList.get(ArrayList.java:322)

20:13:33,756 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.handleNewLine(HtmlBBCodeTranslatorImpl.java:443)

20:13:33,756 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.handleData(HtmlBBCodeTranslatorImpl.java:296)

20:13:33,757 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.parse(HtmlBBCodeTranslatorImpl.java:129)

20:13:33,757 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.parsers.bbcode.HtmlBBCodeTranslatorImpl.getHTML(HtmlBBCodeTranslatorImpl.java:105)

20:13:33,757 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.kernel.parsers.bbcode.BBCodeTranslatorUtil.getHTML(BBCodeTranslatorUtil.java:51)

20:13:33,758 INFO (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.util.MBIndexer.processContent(MBIndexer.java:357)

20:13:33,758 INFO (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.util.MBIndexer.doGetDocument(MBIndexer.java:258)

20:13:33,758 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.kernel.search.BaseIndexer.getDocument(BaseIndexer.java:115)

20:13:33,759 INFO (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.util.MBIndexer.doReindex(MBIndexer.java:314)

20:13:33,759 INFO (http-/127.0.0.1:8180-5) at com.liferay.portal.kernel.search.BaseIndexer.reindex(BaseIndexer.java:326)

20:13:33,759 INFO (http-/127.0.0.1:8180-5) at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.updateStatus(MBMessageLocalServiceImpl.java:1666)


Any ideas on this error or any help from liferay team?
I really appreciate any help!

Thank you and Regards,
Sri
sri p
RE: message boards message display
11 novembre 2013 16:42
Réponse

sri p

Rang: Junior Member

Publications: 81

Date d'inscription: 22 janvier 2011

Publications Récentes

Answering my self :

Liferay htmlbcode parser is checking CR LF, "\r\n" but files thta I uploaded has "\n" so it is throwing parse error information.

Thanks,
Sri