http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2310 *** shadow/2310 Mon Jun 25 08:22:32 2001 --- shadow/2310.tmp.26183 Mon Jun 25 08:22:32 2001 *************** *** 0 **** --- 1,64 ---- + +============================================================================+ + | Transformation hangs when input source is not well formed | + +----------------------------------------------------------------------------+ + | Bug #: 2310 Product: XalanJ2 | + | Status: NEW Version: 2.1.0 | + | Resolution: Platform: PC | + | Severity: Normal OS/Version: Windows NT/2K | + | Priority: Other Component: org.apache.xalan.transf | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + The program below illustrates the problem. The tranformation will result + in an exception, which is caught in the main thread. However, as the + transformation thread has not stopped, the program will not exit. + Also, it is not possible to create other transformers and let them process + documents. + + public static void main(String[] arg) { + java.io.StringWriter out=new java.io.StringWriter(); + try { + String in="<?xml version=\"1.0\" encoding=\"UTF-8\"?><root1></root2>"; + String in_ok="<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>Hello + world</root>"; + String xsl="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ + "<xsl:stylesheet version=\"1.0\" + xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">"+ + "<xsl:template match=\"/\">"+ + "<xsl:copy-of select=\".\"/>"+ + "</xsl:template>"+ + "</xsl:stylesheet>"; + + Transformer t=((TransformerFactory)TransformerFactory.newInstance()) + .newTransformer(new StreamSource(new java.io.StringReader(xsl))); + + try { + t.transform(new StreamSource(new java.io.StringReader(in)), new + StreamResult(out)); + } + catch (Exception e) { + System.out.println("transformation 1 failed"); + } + + t=((TransformerFactory)TransformerFactory.newInstance()) + .newTransformer(new StreamSource(new java.io.StringReader(xsl))); + try { + t.transform(new StreamSource(new java.io.StringReader(in_ok)), new + StreamResult(out)); + } + catch (Exception e) { + System.out.println("transformation 2 failed"); + } + + } + catch (Exception e) { + e.printStackTrace(); + } + out.flush(); + out.toString(); + } \ No newline at end of file
