Changeset 6717


Ignore:
Timestamp:
07/20/10 16:11:03 (9 years ago)
Author:
curtis
Message:

Eliminate excessive xmlvalid output.

Location:
trunk/components/common/src/loci/common/xml
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common/src/loci/common/xml/ValidationErrorHandler.java

    r6495 r6717  
    3838 * @author Melissa Linkert melissa at glencoesoftware.com 
    3939 */ 
    40 class ValidationErrorHandler implements ErrorHandler { 
    41   private boolean ok = true; 
    42   public boolean ok() { return ok; } 
     40public class ValidationErrorHandler implements ErrorHandler { 
     41 
     42  private int errors = 0; 
     43 
     44  public boolean ok() { return errors == 0; } 
     45 
     46  public int getErrorCount() { return errors; } 
     47 
    4348  public void error(SAXParseException e) { 
    44     XMLTools.LOGGER.error(e.getMessage(), e); 
    45     ok = false; 
     49    XMLTools.LOGGER.error(e.getMessage()); 
     50    errors++; 
    4651  } 
     52 
    4753  public void fatalError(SAXParseException e) { 
    48     XMLTools.LOGGER.error(e.getMessage(), e); 
    49     ok = false; 
     54    XMLTools.LOGGER.error(e.getMessage()); 
     55    errors++; 
    5056  } 
     57 
    5158  public void warning(SAXParseException e) { 
    52     XMLTools.LOGGER.warn(e.getMessage(), e); 
    53     ok = false; 
     59    XMLTools.LOGGER.warn(e.getMessage()); 
     60    errors++; 
    5461  } 
     62 
    5563} 
  • trunk/components/common/src/loci/common/xml/XMLTools.java

    r6667 r6717  
    503503    catch (IOException exc) { exception = exc; } 
    504504    catch (SAXException exc) { exception = exc; } 
    505     if (exception != null) { 
    506       LOGGER.info("Error validating document", exception); 
     505    final int errors = errorHandler.getErrorCount(); 
     506    if (errors > 0) { 
     507      LOGGER.info("Error validating document: {} errors found", errors); 
    507508      return false; 
    508509    } 
    509     if (errorHandler.ok()) LOGGER.info("No validation errors found."); 
     510    else LOGGER.info("No validation errors found."); 
    510511    return errorHandler.ok(); 
    511512  } 
Note: See TracChangeset for help on using the changeset viewer.