Bug 807569

Summary: EntityReferences are being replaced by a set of numbers
Product: [Community] PressGang CCMS Reporter: Lee Newson <lnewson>
Component: Web-UIAssignee: Lee Newson <lnewson>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.xCC: dlesage, topic-tool-list
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-01 23:25:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Lee Newson 2012-03-28 08:01:26 UTC
In some cases EntityReferences get replaced by a set of random numbers. eg:

<para>
  This is an example of a para tag: &lt;para&gt;
</para>

gets replaced as 

<para>
  This is an example of a para tag: [2191002]para[-19028];
</para>

when saving the changes in SKynet.

I suspect this has to do with the fix for Bug #739466

Comment 1 Lee Newson 2012-03-28 08:15:34 UTC
Fixed in build 20120328-1753.

Cause:
When multiple EntityReferences were used in side a XML node that contained children nodes (see below for an example), the first node would be replaced and would increase the node count. Since the node count was only retrieved before processing any nodes, the count would be incorrect after the first iteration.

Example:
<para>
  This is an example of a para tag: 
  &lt;para&gt; <filename>/usr/bin/</filename> &lt;/para&gt;
</para>

Consequence:
Any EntityReferences that matched this case would be permanently converted to the temporary placeholder.

Fix:
Instead of getting the number of children nodes before iterating through and replacing the placeholders, I've made it calculate the number of children after each iteration.