[opencms-dev] A really weird XML Template related bug in 4.6

Werner Punz werpu at gmx.at
Tue May 14 14:12:44 CEST 2002


Its me again, I think I found the affected codepart. I just wonder why
nobody else stumbled over this. This bug really is severe. I give a short
explanation what is changed (and yes the bug still is in the latest CVS checkin I
rechecked)

What happens is that the XML Template is perfectly generated with all
necessary entries. Now it is passed down the CmsXMLTemplateFile Object for storage
and here is a method called which is significantly changes since  4.4.1 (I
rechecked with the CVS):

setEditedTemplateContent, 

The lines which cause the bug (please take no offence OpenCMS developers you
did one hell of a job there) are a nice thought but given in the context of
<![CDATA[ flags in between are a complete bogus:

here are the lines which cause the bug (CmsXMLTemplateFile -996-1001):

if(!html){
            // we have to prepare the content for the tidy
            copyOfContent = "<HTML><HEAD></HEAD><body>" +
copyOfContent.substring(9, copyOfContent.lastIndexOf("]]>")) + "</body></HTML>";
}else{
            copyOfContent = replace(copyOfContent, "", "");
}

what happens is that the first <![CDATA[ is cut, the whole thing is merged
into a proper HTML context (IMHO also a problem for element tags which might
also be affected by that) and then passed on. The reason this is bogus is that
there is the possibility of having ]]> and <![CDATA[ in between which are
then not solved in a correct manner.
The funny thing is this codepart was entirely rewritten from a working 4.4.1
code into this nonworking code now in the CVS system.

I have not found a quick workaround to this problem yet, since all XML
related files are heavily affected by this bug. I will try to look at the 4.4.1
codebase and compare the method with the latest codebase maybe I can find
something out on how to solve this in a proper manner. 
It would be great to hear some comments from the OpenCMS developers
regarding this problem and my analysis.

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net




More information about the opencms-dev mailing list