You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/09/13 04:18:00 UTC

DO NOT REPLY [Bug 7357] - cannot stop xalan from java extension

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=7357>.
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=7357

cannot stop xalan from java extension





------- Additional Comments From s_kitching@yahoo.com  2002-09-13 02:17 -------
I see this is still a problem in 2.4.0.

The cause appears to be as follows:
org.apache.xalan.templates.ElemExtensionCall, method execute
catches TransformerExceptions, and has the following line:
          if (msg.indexOf("fatal") >= 0)
ie if a custom extension element throws an exception, *and* the exception
message contains the string "fatal" in it anywhere, then it is treated as a
fatal error, else it is treated as a warning.

This is clearly a temporary hack to get something working, but has now been
around a fair while!

The effects are:
* any exception thrown by an extension element with the substring "fatal" will
terminate stylesheet processing. In fact, I can't see any situation under which
an extension element would throw a non-fatal exception, so this is probably ok.
* any exception thrown by an extension element without the substring "fatal"
occurring in its message will not terminate stylesheet processing. THIS IS BAD!

As an example, calling
processorContext.getTransformer().getErrorListener().fatalError("bye");
from a custom extension will be treated as a warning only!

A workaround is to register a custom error listener which ensures that any call
to error/fatalError throws a new exception with the letters "fatal" prefixed or
suffixed to the message. And if you're not generating english error messages,
tough - the word "fatal" must be present in english. [actually, if you are
french, fatale will also do nicely :-]