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

MsgMgr.message() should call fatalError if terminate is true

           Summary: MsgMgr.message() should call fatalError if terminate is
                    true
           Product: XalanJ2
           Version: 2.5Dx
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The method "message" in class "org.apache.xalan.transformer.MsgMgr" does not 
use its terminate parameter if it has an ErrorListener. 
If terminate is true it should call fatalError() on this ErrorListener instead 
of warning(). 

This also would solve bug# 13453.

Suggestion is to change the existing method:

  public void message(SourceLocator srcLctr, String msg, boolean terminate) 
throws TransformerException
  {

    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
    {
      errHandler.warning(new TransformerException(msg, srcLctr));
    }
    else
    {
      if (terminate)
        throw new TransformerException(msg, srcLctr);
      else
        System.out.println(msg);
    }
  }

  into:

  public void message(SourceLocator srcLctr, String msg, boolean terminate) 
throws TransformerException
  {

    ErrorListener errHandler = m_transformer.getErrorListener();

    if (null != errHandler)
    {
      if (terminate) 
        errHandler.fatalError(new TransformerException(msg, srcLctr));
      else
        errHandler.warning(new TransformerException(msg, srcLctr));
    }
    else
    {
      if (terminate)
        throw new TransformerException(msg, srcLctr);
      else
        System.out.println(msg);
    }
  }

When the "message" method is called from "execute" in 
org.apache.xalan.templates.ElemMessage, currently two exceptions are 
generated. The first one shows the user message and the second one doesn't. 
Since the second one may be caught by the environment (for example Cocoon), 
the user message is lost. With the proposed change only one exception is 
raised and the user message will be reported to the environment.

Reply via email to