sboag 00/07/30 16:06:11
Modified: java/src/org/apache/xalan/transformer TransformerImpl.java
Log:
Fixed error handling.
Revision Changes Path
1.8 +33 -4
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
Index: TransformerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TransformerImpl.java 2000/07/23 17:46:25 1.7
+++ TransformerImpl.java 2000/07/30 23:06:11 1.8
@@ -236,7 +236,10 @@
}
catch (SAXException se)
{
- throw new TransformException(se);
+ if(se instanceof trax.TransformException)
+ throw (trax.TransformException)se;
+ else
+ throw new TransformException(se);
}
catch (ClassNotFoundException e1)
{
@@ -292,11 +295,25 @@
// Kick off the parse. When the ContentHandler gets
// the startDocument event, it will call transformNode( node ).
reader.parse( xmlSource );
+
+ // This has to be done to catch exceptions thrown from
+ // the transform thread spawned by the STree handler.
+ Exception e = getExceptionThrown();
+ if(null != e)
+ {
+ if(e instanceof trax.TransformException)
+ throw (trax.TransformException)e;
+ else
+ throw new trax.TransformException(e);
+ }
}
catch(SAXException se)
{
- se.printStackTrace();
- throw new TransformException(se);
+ // se.printStackTrace();
+ if(se instanceof TransformException)
+ throw (TransformException)se;
+ else
+ throw new TransformException(se);
}
catch(IOException ioe)
{
@@ -527,7 +544,10 @@
}
catch(SAXException se)
{
- throw new TransformException(se);
+ if(se instanceof trax.TransformException)
+ throw (trax.TransformException)se;
+ else
+ throw new TransformException(se);
}
}
@@ -1618,6 +1638,13 @@
// Implement Runnable //
////////////////////////
+ private Exception m_exceptionThrown;
+
+ public Exception getExceptionThrown()
+ {
+ return m_exceptionThrown;
+ }
+
/**
* Run the transform thread.
*/
@@ -1629,6 +1656,8 @@
}
catch(Exception e)
{
+ // e.printStackTrace();
+ m_exceptionThrown = e;
; // should have already been reported via the error handler?
}
}