Unexpected end of input block in CDATA section error while accessing page or space after database conversion to utf8
Symptoms
You get the following error while accessing a page/space:
Error: The XML content could not be parsed. There is a problem at line 12, column 6. Parser message: Unexpected end of input block in CDATA section
The following appears in the atlassian-confluence.log
:
2012-07-05 13:57:59,670 ERROR [http-8080-9] [content.render.xhtml.DefaultRenderer] render Error rendering content for view: The XML content could not be parsed. There is a problem at line 12, column 6. Parser message: Unexpected end of input block in CDATA section
at [row,col {unknown-source}]: [12,6]
-- url: /pages/editpage.action | page: 76546993 | userName: dave | referer: https://wiki.info.nl/display/HF/Bacula+overview+en+howto%27s | action: editpage
com.atlassian.confluence.content.render.xhtml.XhtmlParsingException: The XML content could not be parsed. There is a problem at line 12, column 6. Parser message: Unexpected end of input block in CDATA section
at [row,col {unknown-source}]: [12,6]
at com.atlassian.confluence.content.render.xhtml.StaxUtils.convertToXhtmlException(StaxUtils.java:303)
at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:49)
at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:41)
at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:53)
at com.atlassian.confluence.content.render.xhtml.DefaultRenderer.render(DefaultRenderer.java:63)
at com.atlassian.confluence.pages.actions.AbstractPreviewPageAction.getEditorFormattedContent(AbstractPreviewPageAction.java:189)
at com.atlassian.confluence.pages.actions.AbstractPreviewPageAction.getWysiwygContent(AbstractPreviewPageAction.java:169)
at sun.reflect.GeneratedMethodAccessor1408.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
...
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected end of input block in CDATA section
at [row,col {unknown-source}]: [12,6]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOB(StreamScanner.java:700)
at com.ctc.wstx.sr.StreamScanner.loadMoreFromCurrent(StreamScanner.java:1054)
at com.ctc.wstx.sr.StreamScanner.getNextCharFromCurrent(StreamScanner.java:811)
at com.ctc.wstx.sr.BasicStreamReader.skipCommentOrCData(BasicStreamReader.java:3457)
at com.ctc.wstx.sr.BasicStreamReader.skipToken(BasicStreamReader.java:3325)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2622)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
at com.ctc.wstx.evt.WstxEventReader.peek(WstxEventReader.java:306)
at com.ctc.wstx.evt.FilteredEventReader.peek(FilteredEventReader.java:120)
at com.ctc.wstx.evt.FilteredEventReader.hasNext(FilteredEventReader.java:70)
at com.atlassian.confluence.content.render.xhtml.XmlFragmentEventReader.hasNext(XmlFragmentEventReader.java:49)
at com.atlassian.confluence.content.render.xhtml.XmlFragmentBodyEventReader.hasNext(XmlFragmentBodyEventReader.java:41)
at com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader.hasNext(ForwardingXmlEventReader.java:26)
at com.atlassian.confluence.content.render.xhtml.XmlFragmentEventReader.hasNext(XmlFragmentEventReader.java:49)
at com.atlassian.confluence.content.render.xhtml.XmlFragmentEventReader.close(XmlFragmentEventReader.java:74)
at com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader.close(ForwardingXmlEventReader.java:51)
at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transform(DefaultFragmentTransformer.java:128)
at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:43)
... 236 more
Cause
Something goes wrong during the conversion and breaks some characters after the database import. Example of the broken characters:
latin1 database:
... some sample text financiën.doc
utf8 converted and imported:
... some sample text financi
Resolution
If it is a Production instance and you have new data in the database, it's best to follow the following steps to fix the problem:
- Synchronized the old database backup with the new database to have all the data/content (old and new) intact. You can use the TOAD application.
Convert the database to utf8 with the following SQL statement for each table:
alter table <table name> convert to CHARACTER SET utf8;