Code block macro interpreting its contents in 5.8.16

On a Confluence page we have an XML code snippet that includes a CDATA section, contained within a code block macro. This worked fine in Confluence 5.3.4 and 5.8.10.

<?xml version="1.0" encoding="UTF-8"?>
<beans xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd" 
			xmlns="http://www.springframework.org/schema/beans" 
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	 	
 	<bean id="a39-cronTrigForEventType44" class="com.emeter.hydrofw.scheduler.quartz.CronTrigger">		
		<property name="scheduler" ref="quartzScheduler"/>
		<property name="name" value="EVENTS_ANALYZER_Type44"/>
		<property name="group" value="EVENTS_ANALYZER_Type44"/>
		<property name="eventHandler" ref="a39-eventType44"/>
		<property name="cronExpression" value="1 * * * * ?" />
 	</bean>
 		 	
 	<bean id="a39-eventType44" class="com.emeter.eventsanalyzer.handler.EventsAnalyzerHandler">
 		<property name="eventTypeId" value= "44"/>
 		<property name="eventsSQL">
 			<value>
 			<![CDATA[
				SELECT
				    DEVICE_EVENT.SVC_PT_ID SVC_PT_ID,
				    DEVICE_EVENT.EVENT_START_TIME,
				    DEVICE_EVENT.EVENT_TIME,
				    DEVICE_EVENT.INCOMING_DEVICE_ID INCOMING_DEVICE_ID,
				    DEVICE_EVENT.INCOMING_DEVICE_TYPE INCOMING_DEVICE_TYPE,
				    DEVICE_EVENT.DEVICE_ID DEVICE_ID,
				    DEVICE_EVENT.DEVICE_EVENT_TYPE_ID DEVICE_EVENT_TYPE_ID,
				    DEVICE_EVENT.ORG_ID ORG_ID,
				    DEVICE_EVENT_TYPE.EVENT_NAME
				FROM
				    DEVICE_EVENT,
				    DEVICE_EVENT_TYPE                
				WHERE
				    DEVICE_EVENT_TYPE.DEVICE_EVENT_TYPE_ID=DEVICE_EVENT.DEVICE_EVENT_TYPE_ID AND
				    DEVICE_EVENT_TYPE.DEVICE_EVENT_TYPE_ID= ? AND
					(DEVICE_EVENT.EVENT_TIME > ? OR ? IS NULL ) AND DEVICE_EVENT.EVENT_TIME <= ?     				              
				GROUP BY 
				    DEVICE_EVENT.SVC_PT_ID,
				    DEVICE_EVENT.EVENT_START_TIME,
				    DEVICE_EVENT.EVENT_TIME,				    
				    DEVICE_EVENT.INCOMING_DEVICE_ID,
				    DEVICE_EVENT.INCOMING_DEVICE_TYPE,
				    DEVICE_EVENT.DEVICE_ID,
				    DEVICE_EVENT.DEVICE_EVENT_TYPE_ID,
				    DEVICE_EVENT.ORG_ID,
				    DEVICE_EVENT_TYPE.EVENT_NAME
				HAVING 
				    COUNT(*) >= ?
 			]]>
 			</value>
		</property>
		
		<property name="scanType" value= "Offset From Now"/>
		<property name="eventDuration" value= "36280"/>
		<property name="eventThreshold" value= "1"/>
 		<property name="actions">
 			<list>
			 	<bean class="com.emeter.eventsanalyzer.action.InsertSRActivityAction">
			 		<property name="srList" ref="a39-srListForEventType44"/>
			 	</bean>
			 	<bean class="com.emeter.eventsanalyzer.action.InsertSRActivityReuseOpenSRAction">
			 		<property name="srList" ref="a39-srListForEventType44"/>
			 	</bean>
 			</list>
 		</property>
 	</bean>
	<bean id="a39-srListForEventType44" class="org.springframework.beans.factory.config.ListFactoryBean">
		<property name="sourceList">
			<list>
				<bean class="com.emeter.eventsanalyzer.data.ServiceRequest">
					<property name="type" value="Internal" />
          			<property name="subType" value="Meter Reading" />
          			<property name="activities">        
						<list>
							<bean class="com.emeter.eventsanalyzer.data.Activity">
								<property name="type" value="Meter Service" />
								<property name="subType" value="Load - Disconnect" />
							</bean>
						</list>
          			</property>
				</bean>
			</list>
		</property> 
	</bean>
</beans>

 

However, in 5.8.16 if I edit the page and attempt to save or close, the browser becomes unresponsive. If I attempt to insert the code snippet into a new page, the page will save but the snippet will be truncated just before the end of the CDATA section. In 5.8.16 it seems that the code block is trying to interpret the CDATA section.

Here's the error in the log file: 

Caused by: com.atlassian.confluence.content.render.xhtml.XhtmlParsingException: The XML content could not be parsed. There is a problem at line 58, column 11. Parser message: Unexpected close tag &amp;lt;/bean&amp;gt;; expected &amp;lt;/property&amp;gt;.
 at [row,col {unknown-source}]: [58,11]
	at com.atlassian.confluence.content.render.xhtml.StaxUtils.convertToXhtmlException(StaxUtils.java:468)
	at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:50)
	at com.atlassian.confluence.diff.DaisyHtmlDiffer.transformToHtml(DaisyHtmlDiffer.java:187)
	... 294 more
Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag &lt;/bean&gt;; expected &lt;/property&gt;.
 at [row,col {unknown-source}]: [58,11]
	at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:630)
	at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
	at com.ctc.wstx.sr.BasicStreamReader.reportWrongEndElem(BasicStreamReader.java:3258)
	at com.ctc.wstx.sr.BasicStreamReader.readEndElem(BasicStreamReader.java:3200)
	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2832)
	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:51)
	at com.atlassian.confluence.content.render.xhtml.XmlFragmentBodyEventReader.hasNext(XmlFragmentBodyEventReader.java:41)
	at com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader.hasNext(ForwardingXmlEventReader.java:28)
	at com.atlassian.confluence.content.render.xhtml.XmlFragmentEventReader.hasNext(XmlFragmentEventReader.java:51)
	at com.atlassian.confluence.content.render.xhtml.XmlFragmentEventReader.close(XmlFragmentEventReader.java:80)
	at com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader.close(ForwardingXmlEventReader.java:58)
	at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transformFragment(DefaultFragmentTransformer.java:185)
	at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transform(DefaultFragmentTransformer.java:135)
	at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:45)
	... 295 more

I upgraded both of my production instances to 5.8.16 last weekend before I discovered this issue. I can rewrite this code snippet to resolve the immediate problem. I'd prefer CDATA to be handled correctly within code blocks or at least fail gracefully because I never know when someone will add another code snippet like this one.

Or did I miss something? Is there a flaw in my assessment? 

Thanks!

Teresa

 

1 answer

1 accepted

Thanks! I'll follow up with Support.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

251 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you