cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/util TraxErrorHandler.java
Date Thu, 25 Jul 2002 14:00:31 GMT
vgritsenko    2002/07/25 07:00:31

  Modified:    .        Tag: cocoon_2_0_3_branch changes.xml
               .        changes.xml
               src/java/org/apache/cocoon/components/language/generator
                        Tag: cocoon_2_0_3_branch ProgramGeneratorImpl.java
               src/java/org/apache/cocoon/util Tag: cocoon_2_0_3_branch
                        TraxErrorHandler.java
  Log:
  Include all warnings and errors reported by the XSLT engine into the
  TransformerException if transformation fails or terminated by the
  stylesheet.
  Compensate for the Xalan incremental processing bug.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.138.2.37 +6 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.138.2.36
  retrieving revision 1.138.2.37
  diff -u -r1.138.2.36 -r1.138.2.37
  --- changes.xml	24 Jul 2002 03:38:45 -0000	1.138.2.36
  +++ changes.xml	25 Jul 2002 14:00:31 -0000	1.138.2.37
  @@ -39,6 +39,11 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="VG" type="fix">
  +    Include all warnings and errors reported by the XSLT engine into the
  +    TransformerException if transformation fails or terminated by the
  +    stylesheet.
  +  </action>
     <action dev="VG" type="update">
       Update HSQLDB to version 1.7.0. Now it properly shuts down with Cocoon.
     </action>
  
  
  
  1.222     +6 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.221
  retrieving revision 1.222
  diff -u -r1.221 -r1.222
  --- changes.xml	24 Jul 2002 03:38:44 -0000	1.221
  +++ changes.xml	25 Jul 2002 14:00:31 -0000	1.222
  @@ -39,6 +39,11 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="VG" type="fix">
  +    Include all warnings and errors reported by the XSLT engine into the
  +    TransformerException if transformation fails or terminated by the
  +    stylesheet.
  +  </action>
     <action dev="VG" type="update">
       Update HSQLDB to version 1.7.0. Now it properly shuts down with Cocoon.
     </action>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.15.2.2  +10 -1     xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.15.2.1
  retrieving revision 1.15.2.2
  diff -u -r1.15.2.1 -r1.15.2.2
  --- ProgramGeneratorImpl.java	14 Apr 2002 03:42:51 -0000	1.15.2.1
  +++ ProgramGeneratorImpl.java	25 Jul 2002 14:00:31 -0000	1.15.2.2
  @@ -368,6 +368,15 @@
   
           // Generate code
           String code = markupLanguage.generateCode(is, normalizedName, programmingLanguage,
resolver);
  +        if (code == null || code.length() == 0) {
  +            // FIXME(VG): Xalan with incremental-processing=true does not propagate exceptions
  +            // from working thread to main thread. See
  +            // http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8033
  +            throw new ProcessingException("Failed to generate program code (this may happen
" +
  +                    "if you use Xalan in incremental processing mode). " +
  +                    "Please check log file and/or console for errors.");
  +        }
  +
           String encoding = markupLanguage.getEncoding();
   
           // Format source code if applicable
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +29 -13    xml-cocoon2/src/java/org/apache/cocoon/util/TraxErrorHandler.java
  
  Index: TraxErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/util/TraxErrorHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- TraxErrorHandler.java	22 Feb 2002 07:03:57 -0000	1.4
  +++ TraxErrorHandler.java	25 Jul 2002 14:00:31 -0000	1.4.2.1
  @@ -66,6 +66,7 @@
    */
   public class TraxErrorHandler implements ErrorListener {
   
  +    private StringBuffer warnings = new StringBuffer("Errors in XSLT transformation:\n");
       private Logger logger = null;
   
       public TraxErrorHandler( Logger logger ) {
  @@ -73,50 +74,65 @@
       }
   
       public void warning( TransformerException exception )
  -            throws TransformerException {
  +            throws TransformerException
  +    {
           final String message = getMessage( exception );
           if ( this.logger != null ) {
  -            this.logger.warn( message, exception );
  +            this.logger.warn( message );
           } else {
               System.out.println( "WARNING: " + message );
           }
  +        warnings.append("Warning: ");
  +        warnings.append(message);
  +        warnings.append("\n");
       }
   
       public void error( TransformerException exception )
  -            throws TransformerException {
  +            throws TransformerException
  +    {
           final String message = getMessage( exception );
           if ( this.logger != null ) {
               this.logger.error( message, exception );
           } else {
               System.out.println( "ERROR: " + message );
           }
  +        warnings.append("Error: ");
  +        warnings.append(message);
  +        warnings.append("\n");
       }
   
       public void fatalError( TransformerException exception )
  -            throws TransformerException {
  +            throws TransformerException
  +    {
           final String message = getMessage( exception );
           if ( this.logger != null ) {
               this.logger.fatalError( message, exception );
           } else {
               System.out.println( "FATAL-ERROR: " + message );
           }
  -        throw exception;
  +        warnings.append("Fatal: ");
  +        warnings.append(message);
  +        warnings.append("\n");
  +        try {
  +            throw new TransformerException(warnings.toString());
  +        } finally {
  +            warnings = new StringBuffer();
  +        }
       }
   
       private String getMessage( TransformerException exception ) {
  -        SourceLocator locator = exception.getLocator();
   
  +        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 new StringBuffer( "Error in TraxTransformer: " )
  -                    .append( id ).append( "; Line " ).append( locator.getLineNumber() )
  -                    .append( "; Column " ).append( locator.getColumnNumber() )
  -                    .append( "; " ).toString();
  +            return "File " + id
  +                    + "; Line " + locator.getLineNumber()
  +                    + "; Column " + locator.getColumnNumber()
  +                    + "; " + exception.getMessage();
           }
  -        return "Error in TraxTransformer: " + exception;
  +        return exception.getMessage();
       }
   }
  
  
  

----------------------------------------------------------------------
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