DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5857>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5857

Umlauts like &Uuml; get replaced by &nbsp; when using multiple threads

           Summary: Umlauts like &Uuml; get replaced by &nbsp; when using
                    multiple threads
           Product: XalanJ2
           Version: 2.2.x
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I used the appended test program and test input to reproduce the bug.

Every time you start the 
program a series of html files will generated and some will contain wrong umlauts. 
Umlauts will 
be replaced by &nbsp;

Start the program with the following 
parameters:
./LoginToHtml.xsl ./LoginDemo.xml out/output 10 10

The program starts a 
number of threads (for example 10) each having its own transformer and will generate a 
number of 
html files (for example 10). To check for wrong umlauts simply use diff to compare the 
html 
files.

The problem seems to be somewhere within Xalan.
I used jdk 1.3.1 and 
Xalan_J_2_2_D14 in a Solaris Environment.

---------- Testapplication START ---------------
package 
test;

import org.w3c.dom.*;
import javax.xml.parsers.*;
import 
javax.xml.transform.*;
import javax.xml.transform.stream.*;
import 
javax.xml.transform.dom.*;

import java.io.*;
import java.util.*;

public class 
TestTransform extends Thread
{
        private static int counter;
        
        private Transformer 
transformer;
        private long number;
        private String ID;
        private String 
templateName;
        private String documentName;
        private String output;
        
        public 
TestTransform(String ID, long number, String templateName, String documentName, String 
output)
        {
                this.ID = ID;
                this.number = number;
                this.templateName = 
templateName;
                this.documentName =documentName;
                this.output = 
output;
                counter++;
                
                try
                {
                TransformerFactory tFactory = 
TransformerFactory.newInstance();       
                 transformer = tFactory.newTransformer(new 
StreamSource(templateName));
                }
                catch(Exception 
e)
                {
                        System.out.println(e.getMessage());
                }
        }
        
        public void 
run()
        {               
                transform();
                counter--;
        }
        
        
        public void 
transform()
        {                               
                try
                {                                                               
                        DocumentBuilderFactory fac = 
DocumentBuilderFactory.newInstance();
                        DocumentBuilder builder = 
fac.newDocumentBuilder();
                        
                        Document domDocument = 
builder.parse(documentName);
                        
                        System.out.println(ID+ " starting " + number + " 
iterations");
                        
                        long start = System.currentTimeMillis();
                        for(int i=0; i < 
number ; i++)
                        {                               
                                Writer destination = new 
FileWriter(output+i+".html");
                                
                                Source source = new DOMSource((Node) 
domDocument.getDocumentElement());
                                Result result = new 
StreamResult(destination);
                                
                                transformer.transform(source, 
result);                                        
                                
                                destination.flush();
                        }
                        long stop = 
System.currentTimeMillis();
                        System.out.println(ID+ " time for " + number +" 
iterations:" + (stop - start) );
                }
                catch(Exception 
e)
                {
                        System.out.println("TestTransform: caught Exception" + 
e.getMessage());
                }
        }
        
    public static void main (String args[]) 

        {               
                TestTransform[] threadArray;
                
                String templateName = 
args[0];
                String xmlName = args[1];
                String outName = args[2];
                String strNumber = 
args[3];
                String strThreads = args[4];
                
                try
                {                       
                        int number = 
Integer.parseInt(strNumber);
                        int threads = 
Integer.parseInt(strThreads);
                
                        threadArray = new 
TestTransform[threads];
                        
                        // create threads
                        for(int i=0; i< threads; 
i++)
                        {
                                System.out.println("creating thread " +i);
                                threadArray[i]  = new 
TestTransform("Thread"+i, number, templateName, xmlName, 
outName+"_"+i);                         
                        }
                        
                        // start threads
                        for(int i=0; i< threads; 
i++)
                        {
                                threadArray[i].start();
                        }
                        
                        while(counter>0)
                        {       
                                Thread.currentThread().sleep(1000);                    
         
                        }                                                       
                }
                catch(Exception 
e)
                {
                        System.out.println(e.getMessage());
                }                               
        }
}

----------- 
Testapplication END ------------

----------- Test XML START --------------
<?xml version="1.0" encoding="ISO-8859-
1"?>
<root>
        <Environment>
                <RZBK>8076</RZBK>
        </Environment>
        <FormData>
                <LoginTitle>Test</LoginTitle>
                <USER>ABC</USER>
                <PASSWORD>XYZ</PASSWORD>
        </FormData>
</root>
-
---------- Test XML END ----------------

----------- Test XSL START --------------
<?xml version="1.0" encoding="iso-8859-1"?>
 

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output 
method="html"/>

        <xsl:template name="meta">
                <xsl:text disable-output-
escaping="yes">&lt;meta http-equiv="expires" 
content="0"/&gt;</xsl:text>
                <xsl:text disable-output-escaping="yes">&lt;meta http-
equiv="cache-control" content="no-cache"/&gt;</xsl:text>
                <xsl:text disable-output-
escaping="yes">&lt;meta http-equiv="pragma" content="no-
cache"/&gt;</xsl:text>
        </xsl:template>


<xsl:template 
match="root">
        
<html>
<head>
        <xsl:call-template 
name="meta"/>
        <title>Test</title>
</head>

<body>

                                <table width="600" 
border="0" cellspacing="0" vspace="0" hspace="0" name="show_content">
                                  <tr> 
                                    <td 
width="63"><img src="ebk/images/b_ol_bl_el_01.jpg" width="92" height="29" vspace="0" 
hspace="0" border="0" name="ellipse"/></td>
                                    <td width="537"><xsl:apply-templates 
select="/root/FormData/RZBK"/></td>
                                  </tr>
                                </table>
                                <table width="150" height="2" 
border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
                                                <tr> 
                                    
                        <td></td>
                                                </tr>
                                        </table>
                                <table border="0" cellspacing="0" cellpadding="0" 
vspace="0" hspace="0" width="600" name="headline">
                                  <tr> 
                                    <td width="34"><img 
src="ebk/images/whorwh2234.jpg" width="34" height="18" vspace="0" hspace="0" 
border="0"/></td>
                                    <td width="558" class="white12" 
bgcolor="#32309D">&#160;</td>
                                    
<td width="8"><img src="ebk/images/blwh_2208.jpg" width="8" height="18" vspace="0" 
hspace="0" border="0"/></td>
                                  </tr>
                                </table>
                                <table width="150" height="4" 
border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
                                                <tr> 
                                    
                        <td></td>
                                                </tr>
                                        </table>

                                <!-- 
*********************************************************************************** 
-->
                                <!--  Logintabelle                                     
                 -->
                                <!-- 
*********************************************************************************** 
-->  
                                <table border="0" cellspacing="0" cellpadding="0" 
vspace="0" hspace="0" width="600" 
name="layout_tabelle">
                                  <tr> 
                                    <td width="34"><img 
src="ebk/images/whorwh2234.jpg" 
width="34" height="240" vspace="0" hspace="0" border="0"/></td>
                                    <td width="561" 
class="white12" bgcolor="#E8E8E8"> 
                                      <table width="561" border="0" cellspacing="0" 
cellpadding="0" vspace="0" hspace="0" name="kontonummer">
                                          <tr> 
                                            <td width="222"> 
                                              
<div align="right" class="blue12r">User:</div>
                                            </td>
                                            <td width="14">Test � � � � � � 
Test</td>
                                            <td width="325">
                                                <xsl:value-of 
select="/root/FormData/USER"/>                                              
                                            </td>
                                          
</tr>
                                        </table>
                                        <table width="150" height="40" border="0" 
cellspacing="0" 
cellpadding="0" vspace="0" hspace="0">
                                                <tr> 
                                                                <td></td>
                                                </tr>
                                        </table>
                                        
<table width="561" border="0" cellspacing="0" cellpadding="0" hspace="0" vspace="0" 
name="PIN">
                                          <tr> 
                                            <td width="222"> 
                                              <div align="right" 
class="blue12r">PIN:</div>
                                            
</td>
                                            <td width="15">&#160;</td>
                                            <td width="324">
                                                <xsl:value-of 
select="/root/FormData/PASSWORD"/>                                               
                                            </td>
                                          </tr>
                                        </table>                                       
 
                                    </td>
                                    <td 
width="5"><img src="ebk/images/grwh_2205.jpg" width="5" height="240" vspace="0" 
hspace="0" border="0"/></td>
                                  </tr>
                                </table>                                 
                                <table width="150" height="4" 
border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
                                                <tr> 
                                         
                        <td></td>
                                                </tr>
                                </table>
                                <table width="600" border="0" cellspacing="0" 
cellpadding="0" vspace="0" hspace="0" bgcolor="#32309d" name="lines01">
                                  <tr 
align="right"> 
                                    <td width="5"><img src="ebk/images/whor0205.jpg" 
width="5" height="2" 
vspace="0" hspace="0" border="0"/></td>
                                    <td width="24" bgcolor="#FF9900"><img 
src="ebk/images/fill.gif" width="8" height="2" vspace="0" hspace="0"/></td>
                                    <td 
width="5"><img src="ebk/images/orwh0205.jpg" width="5" height="2" vspace="0" 
hspace="0" border="0"/></td>
                                    <td width="558"><img src="ebk/images/fill.gif" 
width="40" height="2" vspace="0" hspace="0" border="0"/></td>
                                    <td width="8"><img 
src="ebk/images/blwh_2208.jpg" width="8" height="2" vspace="0" hspace="0" 
border="0"/></td>
                                  </tr>
                                </table>
                                <table width="150" height="4" border="0" 
cellspacing="0" cellpadding="0" vspace="0" hspace="0">
                                                <tr> 
                                                        <td></td>
                                  
                </tr>
                                        </table>
                                        
                               
                                 
                                <!-- 
*********************************************************************************** 
-->
                                <!-- Nav3                                              
               -->
                                <!-- 
*********************************************************************************** 
-->  
                                <table width="600" border="0" cellspacing="0" 
cellpadding="0" vspace="0" hspace="0" 
name="nav3_tabelle">
                                  <tr> 
                                    <td width="5"><img src="ebk/images/fill.gif" 
width="5" 
height="4" vspace="0" hspace="0" border="0"/></td>
                                    <td width="85">&#160;</td>
                                    <td 
width="85">&#160;</td>
                                    <td width="85">&#160;</td>
                                    <td width="85">&#160; </td>
                                    <td 
width="85">&#160; </td>
                                    <td width="85"><a HREF="#"><IMG 
SRC="ebk/images/nav3/nav3_hilfe.jpg" WIDTH="85" HEIGHT="24" BORDER="0" VSPACE="0" 
HSPACE="0" alt="Button" tabindex="4"/></a>                                      </td>
                                  </tr>
                                </table>
                                <!-- Ende Nav3 
============================================== -->
                                

</body>
</html>
        
</xsl:template>
</xsl:stylesheet>
----------- Test XSL END --------------

Reply via email to