cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/util TraxErrorHandler.java
Date Thu, 25 Oct 2001 20:29:22 GMT
bloritsch    01/10/25 13:29:22

  Modified:    src/org/apache/cocoon/util TraxErrorHandler.java
  Log:
  Optimize critical path  And fix indentation
  
  Revision  Changes    Path
  1.6       +35 -39    xml-cocoon2/src/org/apache/cocoon/util/TraxErrorHandler.java
  
  Index: TraxErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/TraxErrorHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TraxErrorHandler.java	2001/10/15 10:21:36	1.5
  +++ TraxErrorHandler.java	2001/10/25 20:29:22	1.6
  @@ -20,65 +20,61 @@
    * Warnings and errors are ignored.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2001/10/15 10:21:36 $
  + * @version CVS $Revision: 1.6 $ $Date: 2001/10/25 20:29:22 $
    */
   public class TraxErrorHandler implements ErrorListener {
   
       private Logger logger = null;
   
  -    public TraxErrorHandler(Logger logger)
  -    {
  +    public TraxErrorHandler( Logger logger ) {
           this.logger = logger;
       }
   
  -    public void warning(TransformerException exception)
  -        throws TransformerException
  -    {
  -        final String message = getMessage(exception);
  -        if (this.logger != null) {
  -            this.logger.warn(message, exception);
  +    public void warning( TransformerException exception )
  +            throws TransformerException {
  +        final String message = getMessage( exception );
  +        if ( this.logger != null ) {
  +            this.logger.warn( message, exception );
           } else {
  -            System.out.println("WARNING: " + message);
  -    }
  +            System.out.println( "WARNING: -" + message );
  +        }
       }
   
  -    public void error(TransformerException exception)
  -        throws TransformerException
  -    {
  -        final String message = getMessage(exception);
  -        if (this.logger != null) {
  -            this.logger.error(message, exception);
  +    public void error( TransformerException exception )
  +            throws TransformerException {
  +        final String message = getMessage( exception );
  +        if ( this.logger != null ) {
  +            this.logger.error( message, exception );
           } else {
  -            System.out.println("ERROR: " + message);
  +            System.out.println( "ERROR: " + message );
           }
       }
   
  -    public void fatalError(TransformerException exception)
  -        throws TransformerException
  -    {
  -        final String message = getMessage(exception);
  -        if (this.logger != null) {
  -            this.logger.fatalError(message, exception);
  +    public void fatalError( TransformerException exception )
  +            throws TransformerException {
  +        final String message = getMessage( exception );
  +        if ( this.logger != null ) {
  +            this.logger.fatalError( message, exception );
           } else {
  -            System.out.println("FATAL-ERROR: " + message);
  +            System.out.println( "FATAL-ERROR: " + message );
           }
           throw exception;
       }
   
  -    private String getMessage(TransformerException exception)
  -    {
  -      SourceLocator locator = exception.getLocator();
  -
  -      if(null != locator)
  -      {
  -        // System.out.println("Parser fatal error: "+exception.getMessage());
  -        String id = (locator.getPublicId() != locator.getPublicId())
  +    private String getMessage( TransformerException exception ) {
  +        SourceLocator locator = exception.getLocator();
  +
  +        if ( null != locator ) {
  +            // System.out.println("Parser fatal error: "+exception.getMessage());
  +            String id = ( locator.getPublicId() != locator.getPublicId() )
                       ? locator.getPublicId()
  -                      : (null != locator.getSystemId())
  -                        ? locator.getSystemId() : "SystemId Unknown";
  -        return "Error in TraxTransformer: " + id + "; Line " + locator.getLineNumber()
  -                           + "; Column " + locator.getColumnNumber()+"; ";
  -      }
  -      return "Error in TraxTransformer: " + exception;
  +                    : ( null != locator.getSystemId() )
  +                    ? locator.getSystemId() : "SystemId Unknown";
  +            return new StringBuffer( "Error in TraxTransformer: " )
  +                    .append( id ).append( "; Line " ).append( locator.getLineNumber() )
  +                    .append( "; Column " ).append( locator.getColumnNumber() )
  +                    .append( "; " ).toString();
  +        }
  +        return "Error in TraxTransformer: " + exception;
       }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message