ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Leuschner" <leuschner-l...@gmx.net>
Subject Patch for Style Task (error handling)
Date Sat, 22 Sep 2001 14:51:02 GMT
Hi,
i've had some problems using the style task with the TraXLiaison because
error messages are printed on stdout/stderr instead of being logged through
Ant itself.
I've modified the TraX Liaison to register itself as an
javax.transform.ErrorListener with the Transformer and the
TransformerFactory and pass the TransformExceptions back to the XSLTProcess
task thus effectivly using ant to report errors. For that purpose I've added
two interfaces XSLTLoggerAware and XSLTLogger. The first one defines a void
setLogger(XSLTLogger l) method and is implemented by TraXLiaison. XSLTLogger
defines a method void log(String msg) which is implemented by XSLTProcess
(no modification needed here, this method is already defined in the Task
class). When XSLTProcess obtains the Liaison it checks if the Liaison is
XSLTLoggerAware and if so it calls liaison.setLogger(this) passing itself as
a logger to the liaison which will use it to pass the error messages.
As these changes make use of the standard JAXP error reporting mechanism
instead of relying on the xslt processor of printing out the errors on
stdout/stderr I think they will be useful for others and hope they can be
put into cvs. Another advantage is that errors now are in a standard format
('filename:linenumber:columnnumber: (Error|Fatal Error|Warning): message')
which makes it easier to parse them in an ide.

Best regards

	David

Mime
View raw message